Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is Pull Request?

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

The main content of this article is to explain "what is Pull Request". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what Pull Request is.

What is Pull Request?

The full name of PR is Pull Request. Students who often use Github must be familiar with this. Github gathers 40 million developers and hundreds of millions of open source projects. If you want to contribute code to other people's open source repositories, you usually first fork other people's projects, then make local modifications and submit them to your own personal fork repository, and finally submit PR to wait for others to integrate your code.

Workflow for Github:

Fork workflow

Let's focus on step 6. After writing the code, Xiao Ming wants to merge into the original author's warehouse, create a new "pull request", pull the request? This is obviously a push. Xiao Ming pushed his revision to the original author's warehouse and felt that it was more appropriate to call it "push request".

Since Github insists on being called "pull request", let's try to understand its train of thought. Xiaoming must be thinking after writing the code: the original author, God, I have changed something, please pull my changes back. From the point of view of the original author, it seems reasonable to call pull request. Every day, a large number of people fork code from me, and I will only pull back the code I am interested in.

I seem to have convinced myself.

What is Merge Request?

The full name of MR is Merge Request. I believe all students who have played Gitlab know this.

By the way, why do people still play Gitlab when Github is so easy to use? this was mentioned a few years ago. Before Microsoft buys Github, all the projects on Github must be public, that is, the bad code must also be made public, not choking. But in some small companies or start-up teams, code as a core asset does not want to be made public, and they are in urgent need of private positions, so many people choose Gitlab. Of course, later, Github also opened up the private warehouse, which is later.

Merge workflow

Everyone on the team pulls the code from the remote repository develop branch, creates a new feature branch locally based on the develop branch, modifies the code to push the feature branch to the remote warehouse, and then the new Merge Request expects to merge its own feature branch into the develop branch.

Judging from the above process, Merge Request is to integrate its own feature branch into the trunk branch.

Pull Request VS Merge Request

Summarize the above two examples.

Github plays fork mode, and developers submit their own code to create a new Pull Request, asking the original author: "pull my code back."

Gitlab plays branch mode, and developers submit their own code to create a new Merge Request and want to merge their own feature branches into the trunk.

The summary above seems to make a lot of sense, but don't forget that Github can also play branch mode, Gitlab can also play fork mode, and what is more speechless is:

Merging branches on Github is still called Pull Request;Gitlab fork mode is also called Merge Request

No, I can't accept this answer. Go to stackoverflow to find out how people understand it. Sure enough, there was a popular post:

Pull request vs Merge request

One answer is an excerpt from Gitlab's official explanation:

Merge or pull requests are created in a git management application and ask an assigned person to merge two branches. Tools such as GitHub and Bitbucket choose the name pull request since the first manual action would be to pull the feature branch. Tools such as GitLab and Gitorious choose the name merge request since that is the final action that is requested of the assignee. In this article we'll refer to them as merge requests.

There is no essential difference between the two, and they have different opinions from different positions.

All right, the authorities have closed the coffin. These two are the same thing. Don't wrestle with each other.

Complain crazily

For beginners, Github's pull request is really difficult to understand, let's go to the major websites to see the voices of users.

StackOverflow

From abroad to China, there are a large number of users do not understand the name, obviously submit the code, why is pull request, some people even suspect that the name is mistyped.

If I were asked to name Github, I might choose:

Push request push request merge request merge request so far. I believe you have a deeper understanding of "what Pull Request is". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report