Feature branch code reviews
Here’s the flow. Read Josh Susser’s post for the git commands.
- Start a user story.
- Code the feature.
- Push the feature to a branch.
- A GitHub hook starts a CI build.
- A GitHub Campfire hook posts your work to Campfire.
- Click the link that’s in Campfire.
- Click the GitHub “Pull Request” button.
- It selects all commits in your branch that are not in master.
- Create the pull request.
- Ask your team in Campfire for a review of the pull request.
- The team comments in-line, right on the code.
- Make the suggested changes.
- Merge into master.
- Push to master.
- CI runs again.
- Deploy to staging.
Many teams use this “feature branch” pattern. The “code review” part is the GitHub pull request to team comments.
Here’s what a pull request looks like:
jm-cm-client-sets-up-recurring-payment branch is compared to master.
And here’s what a comment on a commit looks like:
Test-Driven Development moves code failure earlier in the development process. It’s better to have a failing test on your development machine than in production. It also allows you to have tighter feedback cycles.
Code reviews that happen right before code goes into master offer similar benefits:
- The whole team learns about new code as it is written.
- Mistakes are caught earlier.
- Coding standards are more likely to be established, discussed, and followed.
- Feedback from this style of code review is far more likely to be applied.
- No one forgets context (“Why did we write this?”) since it’s fresh in the author’s mind.