Code Reviews - Inherit in Git

Code Reviews are common in software development. One programmer reviews another's code to find potential issues or to see if the developer could have used something that the system already provided.

With multiple programmers, you can probably expect a versioning system, perhaps a centralized versioning system like SVN or Perforce. With that system, each programmer would make his/her changes and then would check in his/her changes into the repository. From there, the programmer's peers would review the code.

What's the problem with this system? The code is already checked in. The pressure is on the peers to ensure that the code is good, and it's likely that this could slip through the cracks. I mean, those peers are working on getting 10 features complete themselves.

Enter Git

Well, I would argue that Git has a strong code review process built right in. This is due to the process of how distributed version control works.

Programmer A creates a fork of the master project. A makes his changes and commit his code; however, the code is committed to his local repository and not the master origin. This is because A does not have write access to that repository.

A has to contact programmer B, who has write access. A tells B that he should pull his code. Since B has to pull the code, this means that B has to review the code coming in.

It's this workflow that promotes code review. Now that's not to say that you can't do code reviews in a centralized model, it just fits a little better in a distributed model


comments powered by Disqus