Skip to content

Squash commits without rebasing

If you ever needed to rebase (with or without squashing) interactively on the git command line, you know that this is a tedious task. What if I told you, there’s a way to do this much easier?

You need the following setup:

  • master branch as destination (clean)
  • Your source branch with commits to squash (We will call it work)

You need to be on the master branch, then run the following command:

git merge --squash work

Now you have your changes on the destination branch. Now you can commit everything at once, done.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.