Git squash via sourcetree
May 19, 2019

There are some very detailed posts on dev.to how/why to git squash. Especially from the cli. Here's how you might do the same thing with sourcetree.

I am the maintainer of an alpine package and the maintainers of alpine's package system are sticklers. Each time I submitted an update, they requested that I squash my commits. This confused me because GitHub allows you do that automatically on pull requests. Well I guess I should appease the maintainers and learn how to do it.

Sourcetree HD version

It took me a long time before I realized to git squash commits that have already been pushed, you'll need to force push. Sourcetree hides the ability to force push, which is fine by me.

git push --force

Then after that, the branch will look like this.

After git push --force

This is the basic concept that you'll use on your branches. Sourcetree makes it more visual of a process.

Get updates