26 Jan 2012

View the changes between two branches of a git repository in SourceTree

I use git for all my projects, because of how easy it is to deploy new versions & because of how easy it is to maintain two (or more) different versions of one project. I'll be talking a little bit about that second feature in this post.

I typically separate my projects into two branches:

I don't make any actual commits to the Master branch. All of my work is done within the development branch, and I merge the development branch into the Master branch when I'm ready to deploy a release. Sometimes I'll work so much on the development branch that I'll forget all the changes that I've made since the last merge. If that happens, I turn to SourceTree so that I can view the differences between the last merge and the merge I'm about to complete. To do that, I open the repository in SourceTree (free in the Mac App Store) and click on a branch:

Select A Branch

This displays all of the commits for all branches in the top middle window pane. You can kind of see the dev branch in the screen shot above, which is in blue. When I scroll down through the list of commits, I eventually come to the last time that I merged the development branch into the Master branch. This is the last "release version" of the project & I select this entry by clicking it:

Select the previous merge

Then I scroll all the way back up to the top of the list of commits. I ⌘-click (command-click ... pretzel-click ... however you refer to it) the very latest commit. This displays, in the bottom left window pane, a list of files that were changed between the last merge and the latest commit. I click through each file, which displays the line-by-line changes in the bottom right window pane, double checking all the changes in order to remind myself of everything I've done. This helps me remember whether I've made any drastic changes that will require further action surrounding deployment.

After I'm comfortable with the changes that will go through, I go back to the GitHub Mac App. I'm much more comfortable doing the actual git work with this app, because of how simple it is. I don't have a very in-depth knowledge of git, and the GitHub App really keeps me from being able to do much harm.


developer-tools development git github mac sourcetree

Related Posts

17 Dec 2013 Donoku
28 Dec 2012 How to make SublimeLinter work with Ruby & RVM
09 Dec 2012 The tech behind getting Blizzalert into its third season
03 Nov 2012 Little-Corner is now a Heroku-ready Rails app
14 Oct 2012 Sip as a replacement for Pick as a replacement for Digital Color Meter in Mac OS X