Code Review from the Command Line

submited by
Style Pass
2021-09-25 19:00:06

I do the bulk of my code reviews from the command line, especially when reviewing larger changes. I’ve built up a number of tools and config settings that help me dig into the nuances of the code I’m reviewing, so that I can understand it better than if I were just browsing online.

When I ask that other people review my code, it’s an opportunity for me to teach them about the change I’ve just made. When I review someone else’s code, it’s to learn something from them. Some other benefits of code review include:

If this is different from how you think about code review, check out this talk. Code review is a powerful tool for learning and growing a team.

The first step to reviewing code in the terminal is to check out the code in the first place. One option is to simply to git pull and then git checkout <branch>. But if you happen to be using GitHub, we can get this down to just one command:

It works using hub, which is a tool that exposes various features of GitHub from the command line. If the pull request is from someone else’s fork, hub is even smart enough to add their fork as a remote and fetch it.

Leave a Comment