Squash in SourceTree

Updated Answer

SourceTree for Windows

As of version 1.5, you can now do interactive rebases, which will allow you to squash.

SourceTree for Mac

Interactive rebase has been available in SourceTree for Mac since version 1.6 (emphasis mine):

The git rebase –interactive command allows you to reorganise your commits after you’ve created them (but before you’ve made them public), and now you can do this inside SourceTree. Combine (squash) multiple commits together, or re-order them, simply by dragging & dropping. You can also change the commit message, or edit the content of the commits. Just right-click on a commit in the log and choose ‘Rebase children of <sha> interactively’ to kick the process off.

Old Answer

Apparently squashing commits is a feature in SourceTree version 1.6 for the Mac.

However, the feature doesn’t seem to be available in the Windows version of SourceTree, which is currently still at version 1.0.8.

Using the command line

You still have the option of using the command line to squash commits:

git rebase -i <sha-of-base-commit>

In the TODO list, put an s (for squash) next to commits to squash into the previous commit:

pick e953225 Add meow meow meow
s def892d Add master

To learn more about how to squash commits using the command line, see Squashing Commits, from the FREE online Pro Git book.

Leave a Comment