DEV Community

Kyle Parisi
Kyle Parisi

Posted on


Git squash via sourcetree

There are some very detailed posts on 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.

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
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (0)

Here is a post you might want to check out:

Regex for lazy developers

regex for lazy devs

Sorry for the callout 😆