Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a merge request?

Tags:

git

git-merge

On services offering cloud Git repositories, I always find merge requests. What is its purpose? Who was supposed to create it?

Also, what+s the lifecycle of a merge request? Someone creates it, and then - what cycles it should pass?

like image 651
sandalone Avatar asked Apr 15 '14 07:04

sandalone


People also ask

What merge request means?

A merge request (MR) is a request from someone to merge in code from one branch to another. You can create a MR from Assembla by clicking on New Merge Request, which is in almost all of git sub-tabs. You'll be asked to select a “From” branch and a “To” branch.

What is the difference between pull request and merge request?

A Git pull request is essentially the same as a Git merge request. Both requests achieve the same result: merging a developer's branch with the project's master or main branch. Their difference lies in which site they are used; GitHub uses the Git pull request, and GitLab uses the Git merge request.

Why do we need merge request?

A merge request is a regular review moment to check if your teammates still have the same standards and values about testing, quality and code style. It also ensures that these are and remain uniform within the project. It is important that the team is aware that a review is meant to improve together.


2 Answers

Merge Request and Pull request basically refers to same thing. 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.

Pull/Merge requests are created if you are working in a feature branch and wants to merge your change in main branch(eg. Master branch). The merge requests serves as a code review tool and if your code reveals shortcomings/issues anyone(usually other developers) can commit and push a fix.

Life cycle : You create a branch, fix some issue or add a feature, create a pull/merge request, then you assign it to someone, he/she will review your fix and can accept/reject the pull/merge request.

Please note that a merge/pull request should not be confused with the "git merge" or "git pull" command.

like image 52
Rahul Mishra Avatar answered Oct 17 '22 21:10

Rahul Mishra


I believe you are referring to pull requests (PR) which you merge into your master branch. Pull requests are the standard way of people who have branched off (forked) your code to then commit back to the master branch. Generally one PR should solve one bug or add one feature. This is usually achieved using feature branches on the forked code and then creating a pull request on that branch when the feature is completed. This makes merging much easier and means that if you work on multiple features and one is rejected but the other is accepted, their branches do not collide.

So to answer your question of who is supposed to create them, it is usually people who have forked your code. This may even be people on your development team if that's how you choose to work. The main area where this works is with public open source projects. For example, openssl has a public github that anyone can fork, and then if someone wanted to add a feature or fix a bug they would: fork, branch, commit, push and submit a PR.

Once a PR is created, the lifecycle it takes is down to you. It is not predefined. In general the least you must do is: decide if the bug or feature is worthwhile, check over the code to ensure it does what it says and is well written and meets any coding standard set out for your project and then if it good, accept it and merge it.

You can make the lifecycle more complicated by having it go to a development branch to be tested by testers with other development features before being merged into the master but really it is down to you to find a workflow that works for your project.

like image 23
flungo Avatar answered Oct 17 '22 23:10

flungo