Code Review and Git Merge Requests
Learning the workflow...
Getting started with git merge requests and code review workflows can be daunting. But as your projects grow, merge requests and code review can supercharge your development. Here are a few of the benefits:
Unfuddle makes it very easy to get started with code review in your team. Let's look at how it works.
Code review starts with great task management. You are probably already keeping track of bugs and upcoming features in your products. But are you using git branches to empower your workflow? Many teams make code changes right in the master branch of their repositories. They then close the task and move on.
Rather than working only in master, code review depends on branching. Before working on any new task, developers should first create a branch and make all modifications in that branch. When the work is complete, it's time to create a merge request.
Merge requests give your team the opportunity to review and comment on the work BEFORE we allow a merge into the master branch.
Let's say we are working to resolve a bug in our product.
First, we create a branch called "12-bat-gloves-bug" and do all our work there. When we finish, we push our branch to the server. Then we create a merge request from the task in Unfuddle. We need only to specify the branch where we did our work.
Our task now has some new tabs that show the contents of the merge request. Our team members can now easily see that this task has an open merge request waiting for review.
It's time for the team to help out. Team members have the opportunity to review our code and comment. The team will be looking for these kinds of issues:
The team can comment on any of the lines in the commit. These comments will appear inline with the code, but they will also appear on the task activity.
Code review discussions will often lead to modifications to the code. We can make modifications directly in the branch that we want to merge. These changes will automatically appear in the merge request. Conversation can continue until the team reaches consensus on the code.
So discussion has ended and we have decided that the code is good! Yay! Now, we need to merge the code into master. We can do this using our git client, as normal. Or we can perform the merge right in Unfuddle:
After the merge is complete, we can delete the branch where we did our work.
Congratulations, you just rocked code review!