Mandatory Code Review for Protected Branches

Posted by Sergiy Golub on April 9, 2013 02:33:00 AM

Assembla Merge Requests adds a great value to code development process. Now it’s time to bring some more automation to the Code Review process. And here comes a new version of Protected Branches for GIT.

Old Flow

Previously, a feature development or a bugfix looked like:

  • Create a new feature branch based on current production master
  • Do some development and push code to new feature branch
  • Go to Merge Requests Tab and create a Merge Request from new feature branch to master branch

New Flow

Now, we have  Protected Branches, where ‘master’ branch is protected by your Tech Leads, it looks as follows:

  • No need to create a new feature branch, do development on master.
  • Push code to origin master

What is going to happen behind the scenes when you push:

  • A new temporary remote branch with ‘assembla-’ prefix will be created and your commits will be pushed to that branch, remote master will stay the same.
describe the image
  • A new merge request from this temporary branch to master will be created, you will see URL to MR in command line
merge request index resized 600

This occurs in 2 cases:

  • When you are a developer without write permission to ‘master’.
  • When ‘Mandatory review’ checkbox is checked for ‘master’. In this case, all pushed code will go through review process, no matter if pusher has write permission or not.
protection settings resized 600

To continue development on new automatic branch:

$ git fetch origin
$ git checkout assembla_1e65051188
$ echo “Hey, Merge Request Boss!” > WeContinueDevelopment # modify some file
$ git commit -a -m “We continue development to create new MR version”
$ git push origin assembla_1e65051188

We hope, you will enjoy the New Flow. To learn more about Assembla features or Sign Up for a Trial, click here.

Get started today with a 7–day FREE trial.

No obligations, no credit card required.

Get Started Now

About the author

Sergiy GolubVP Engineering Assembla

Get updates about development, productivity, and teamwork