DEV Community

Kyle Parisi
Kyle Parisi

Posted on

4 3

Git squash via sourcetree

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


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.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more