Today we are announcing Advanced Merge Requests for Git. You can find them in your Git/Source tool under the “Contribute code” and “Review code” sub-tabs. As a contributor, you can use a merge request to submit a change from your branch or fork. As a reviewer, you can use merge request view to pull and test changes, vote on them, discuss them, and merge them.
We enjoyed testing this feature. It's exciting for me to see code contributions piling up in the merge request list from our own developers, ready to go into the daily releases. Merge requests are an important part of a Scalable Agile process by allowing you to select and release what's ready rather than slogging through a pre-planned iteration. It saves time, improves quality, and increases creativity.
A year ago, I talked about four ways to manage code and simplify projects. Merge requests help you implement two of them, which I will call "fork" and "branch" because you can submit merge requests from a fork or a branch.
In the fork workfow, contributors post merge requests from cloned or "forked" repositories. "Maintainers" pull the changes, test them, and commit them. This is the github workflow that revolutionized open source development.
Fork workflow is good for independent teams and for people who work independently and are ready to maintain their own clones. It puts some load on the maintainer, which we spread around in our implementation with features like voting.
In the branch workflow, contributors make temporary branches of the master version and submits them as "changes." A core group reviews changes and accepts them. Our implementation is modeled after the Gerrit system that Google uses for Android contributions.
Branch workflow is good for full-time teams that work closely together and for products where the master branch is maintained to be releasable.
How To Use Merge Requests
To contribute with a branch, "git branch" locally to create a branch for your contribution, and push your changes. Now you can go to "Contribute code" under the Source/Git tab and select "New Merge Request." Search for your branch, and write a description of your contribution. Optionally use #<ticket> to link it to a ticket.
Now the merge request shows up in this nice list for reviewers.
The list is sorted with the most recently active on top, and it shows the current vote and comment counts. You can see your requests by selecting "me" from the user filter.
Click on a merge request to review or respond. You will see something like the screen below, where we provide instructions for each role.
Review: If you have rights to review and merge in the target repository, you will see a reviewer bar. To get and test the code, select "Get changes" to see the Git commands, or just select the clipboard icon to grab them. Then comment, vote, or merge. You can vote just by selecting the red and green buttons. Ultimately, the goal is to "merge and close," accepting the change, or "Ignore," discarding the change.
Contribute: If you have rights to contribute in the source repository, you will see a contributor bar where you can submit a new version, after changes are pushed to the source branch. In the branch case you will usually have both contributor and reviewer rights. Speedup tip - if you are a reviewer, you can often fix a change and add it as a new version. It works great if you create pairs to review each other's code.
The review panel is under the Version bar. You can see the discussion thread and write your own comments. My favorite feature is the "files affected" tab, where you can see all of the changes and pop them open in an AJAX panel to see the diff.
Merge request events such as posting a request, comments, and votes, show up in the activity stream as "code reviews" with this icon . You can subscribe to email alerts by going to the Stream tab > email notifications subtab > and selecting "Code reviews."
Past and Future
We started thinking about improving merge reqeusts a year ago when we embedded Gerrit and started using it in the Assembla development team. We eventually decided that we wanted to bring our customers something that would be simpler to use, integrated, and available in local languages.
Now, we believe that advanced merge requests are a core feature of our scalable agile process. We are committed to upgrading the Git workflows and to implementing merge requests for our other repository types.