Code Reviews using Github Team

Code Reviews using Github Team

Before we even get started I know someone is thinking, " Why should I bother with doing code reviews?". Well, it is good practice to do code reviews, it helps give a fresh set of eyes to identify bugs and simple coding errors before your product gets to the next step, making the process for getting the software to the customer more efficient. Simply reviewing someone's code and identifying errors is great. To do this we use branches on Github.

Creating branches is very simple to do and in this tutorial, I am going to create only one branch called develop as shown below.

git.png

To learn more about how to create branches please see GitHub docs. When done creating a new branch we have to make it the default branch so all changes will be pushed to this branch. To do this we have to go to Settings and select Branches then select the new branch to make it default and update.

git3deafultbranch.png

When all this is done we have to add rules to our branches both master and develop. These rules are where we control what is merged to develop branch. Depending on the magnitude of your team you set how many people must review code before it is merged with other code in the branch, you can set it to three code reviewers so that there are fewer delays in merging the code to the branch.

addGitRules.png

Click on Add rule to add a new rule. The branch name pattern is the name of the branch. Select Require to pull request reviews before merging and select 3 from the dropdown.

addGitRules.png

If you scroll down on the branch rule page you will find a lot more rules which you can select depending on the needs of your team. I recommend you also select who can push to matching branches as below.

addGitRules.png

After all the rules are selected save changes and do the same for the master branch. For the master branch add senior team member/s that can merge code to this branch.

Note: The purpose of this article was to hopefully get you started on using Github Team for contributing and collaborating, it does not in any way cover everything about managing teams and collaborating, to learn more, I encourage you to go over the official documentation ...