The difference between Merge Request and Pull Request

What is the difference between Pull Request and Merge Request?

In my previous impression, PR and MR should be different. I believe most people will also have this idea.

scenes to be used

If you often use Github, you should have a certain understanding of Pull Request.

If you often use Gitlab, you should have a certain understanding of Merge Request.

Based on our understanding of Github and Gitlab, and based on the different usage scenarios of the two, we should understand that there is a difference between Pull Request and Merge Request.

Github is generally a public library. Of course, no one wants others to modify the code directly in their own warehouse. Of course, when others want to merge the code for themselves, they usually have to fork a warehouse and then develop it in the developer's own warehouse. After the development is completed, submit a PR merge request to the original warehouse and request the original warehouse owner to pull your code. )go back.

The picture below is the general Github workflow.

Insert image description here

Gitlab is generally a company's private library. A working team maintains a warehouse. Usually everyone will create their own development branch. After development is completed, the code will be merged into the main branch.

The figure below is the general Gitlab workflow.

Insert image description here

Based on the above understanding, I initially thought

  • Github's model that requires forking a repository should be called Pull Requset, which requests the target repository to pull your code.
    "I changed your code, please take it back and take a look!"
  • Gitlab's pure branch mode should be called Merge Request, which is your own request to merge the code into the trunk.
    "Request code merge!"

The above understanding is correct. after all

  • You can also play branch mode on Github, and submit merge requests using Pull Request.
  • You can also play in fork mode on Gitlab and submit merge requests or merge requests.

The actual situation

GitLab officially says this:

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.

The general meaning is that Merge Request and Pull Request are the same thing, just with different names.

Generally, when we perform branch merging, we need to execute the following two commands:

git pull // 拉取需要合并的分支
git merge // 合并到目标分支

Github chose the first command to name it, Pull Request.

Gitlab chose the last command to name, Merge Request.

This reason is officially given by Gitlab, and I think it is still credible. So our conclusion is that "Pull Request and Merge Request" are the same thing.

personal opinion

Pull Request is a really bad word! I remember when I first started using Github, I couldn't understand what Pull Request was for.

  • Does a Pull Request ask someone to allow me to pull their code? Can't I pull other people's code if I don't request it?
  • Would it be better to call the code submission Push Request? Indicates that I want to push code to someone else's warehouse.

If I were to come up with names, I would probably come up with these names:

  • Merge Request requests to merge the code into it
  • Push Request requests to push the code in
  • Check In Requset Initiates code access check
    ...

No matter how hard you think about Pull Request, a good name is still very, very important. I can find many people on the Internet asking what Pull Request means, and everyone’s explanation is almost the same as “asking others to pull your code.” If this name was not used at that time, everyone would understand it at a glance and there would be no need to ask.

Guess you like

Origin blog.csdn.net/weixin_44388689/article/details/132455243