This post is really more of a reference for me than anything else. If you’re using Git (and you should be), and you are doing code/peer reviews (you are, right?), there are a few simple commands that can simplify reviewing a feature that’s spread across multiple commits. Here are those commands.
First you’ll want to see which files were changed as part of the commit. Here’s a simple Powershell command that will do the trick:
git log --grep=<story id> --name-only --pretty=format:'' | Get-Unique | sort
This grabs all the files that are changed in commits associated to a particular story ID, then pipes them to Powershell to get a list of unique names.
Next, you’ll want to diff the changes to the files. Find the first commit that’s part of the story, grab it’s parent commit hash (the hash of the previous commit), then grab the hash of the final commit. Run this command for each file that you got from the first step:
git difftool <starting hash> <ending hash> <full/path/to/file.ext>
This will fire up your configured diff tool with the changes between the two commits. One thing to note: if there were commits in between that altered the files, you’ll also see those changes.
Happy peer reviewing!