Github and code review
I first wrote a post in March 2012 about code review with SVN. Since then, we’ve switched to Github and it’s awesome.
Github isn’t free, buts its very inexpensive and amazing. Inline comments, automatic issue tracking, and you can backup your code to their servers without needing commit access to the main repo.
The work flow
1) You create a repo.
2) Person A forks the repo and clones it to their local machine.
3) They work all day long and at the end of the day push their changes to their fork.
4) They feel inspired when they get home and want to keep working. They clone their fork from github to their home computer and keep working. With SVN, they would have needed to create a branch (which means they have commit access to the main repo) or they need to create their own repo which makes merging a pain later.
5) They’re done working at home, they push their changes to their fork, and submit a pull request to you.
6) You open the pull request and review their work. You notice they made a mistake in a regular expression on line 57 so you click the line and add a comment. An issue is automatically created and assigned to them.
7) They log in, see the issue, fix the issue, and resubmit the pull request.
8) You review and approve and life goes on.
A few comments
A user can submit a pull request to any fork, not just the master one. This makes forming teams super easy. You create a repo and all the members of Team A fork it, but they submit their pull requests to the Team Leader of Team A. Maybe they send daily pull requests to the Team Leader to review and he sends you weekly pull requests. You get the idea. This is perfect for our organization. Someone with a year of experience is perfectly capably of reviewing/mentoring a new hire, but you still want them to be reviewed by the people with 5 years of experience.
Github charges by the number of private repos, and forks don’t count! And yes, the fork of private repo stays private. If you have a single project using a single repo, it doesn’t matter if you have 1000 people collaborating on this project, it still only counts as one repo. Even though “technically” each fork is a repository (and stays private!) it doesn’t count towards your total.
I still think SVN is great. I have private SVN hosting with Beanstalk and I don’t plan on switching to github, but this is for my private projects. I don’t need to worry about collaboration, code review, team hierarchies, ect. The simplicity of SVN makes it an easy choice for personal projects, but for anything that requires collaboration, I’m going with github from now on.