I recently read some discussion on the internet about using git clients, I don’t remember the actual topics but it got me thinking about why I prefer using SourceTree.

The short answer is the amazing ‘stage lines/hunk’ functionality. And yes, I know this exists in the CLI as well.

Let’s take an example of something I am working on right this moment, an actual real-life example.

The current state has a couple of different “types” of changes. The ones in the picture below is A) actual changes and B) a random todo-note that I added just before stopping the work. Just a reminder.

sourcetree0.png

Now, even though the code is mixed between actual work and the inline reminder, I can still organise the commit very easily.

Like this

sourcetree1.gif

Now that was a very very trivial thing, but in a bigger feature thing it is not uncommon to have work spread out over 6 files with 10 chunks in each one. And while developing those you might add random code for testing, inline comments that doesn’t need to be in the same commit as the code or other things - I am sure you’ve done it before.

Here’s another file in the project. All of this is generally temporary code, some file-context notes, todos and other stuff. Using SourceTrees ‘stage lines/hunk’ I feel comfortable leaving this around for later. Sometimes these extra chunks of ‘temp’ code hang around for days or weeks.

This also means that for every commit, you ‘must’ skim through each file and stage only what you want to commit. This serves as a final reminder of your code and has on multiple occasions led me to moments where I had added some temp code which wasn’t supposed to be committed.

sourcetree2.png

And again, yes - I know that all of this can be done without a GUI :)