Two-Level Code Review Using Git Pull Request in BitBucket

bitbucketcode-reviewsgitpull-requests

The following procedure: We have Development branch and

  1. Developer create feature branch from Development
  2. Work and commit in this branch
  3. Rebase from Development
  4. Create pull request
  5. Code review
  6. Merge with Development

Problem that we should have 2 level code review, performing by different people. After first review approval, it goes for second review and merging only after this.

How to do this? Should we add additional branch between Feature and Development branches? Or some more simple way?

Best Answer

I do this quite frequently, for microservices other teams own, or for documentation changes to tech pubs. We have separate repos for individual microservices, with only a scrum team or two having merge permissions for each. I want my own team to review thoroughly before I waste the time of the owning team.

The easiest way I have found is to fork the repo into my private profile, then do all my work from a branch on my fork. I do a pull request against master on my fork first, then when that is approved, do a pull request against master on the "official" repo.

The reason I started doing it this way is our team is somewhat of a trusted innovator, so other teams would often just merge anything we sent them without questioning it. Doing the first pull request in a separate repo meant they couldn't merge it prematurely just by clicking a button. The permissions and visibility on both repos are easily controlled.

You don't have to do this with personal forks, you could create repos for longer-lived larger groups if that works for your use case. Perhaps one repo for everything from a certain contractor company, for example.