Git Extensions: Squash commits? Git Extensions: Squash commits? git git

Git Extensions: Squash commits?


There are multiple ways of doing a squash.

Here's how you can easily squash the current and all its immediate parent commits into a single commit in Git Extensions:

  1. Right click on a commit you wish to squash to and select "Reset the current branch to here"
  2. Select either "Soft reset" (retain staged files) or "Mixed reset" (unstage all files)
  3. Stage, if necessary
  4. Commit

Here's an animation of the above:

enter image description here


Another way is to do an "interactive rebase" either

  • via a command line (git rebase -i, read docs), or
  • via UI (e.g. Git Extensions).

To do an interactive rebase in Git Extensions:

  1. Right click on a commit you wish to squash to and select "Rebase current branch on > Selected commit interactively..."
  2. In the presented dialog alter the history, such as choose which commits to squash or reword
  3. Save and close

Here's an animation of the above:

enter image description here


Here is the slowed down version of the accepted answer:

Here is the slowed down version of the accepted answer


(Assuming you're using Windows)

Yes, I believe TortoiseGit can do it. As a previous user of TortoiseSVN, I would recommend it. When viewing the commit log, you can do the following:

Combine multiple commits context menu

In addition, when you commit using TortoiseGit, you'll have the option to simply amend your previous commit, so you can do this as you go. It will also pull in the last commit message when you do this (I cleared mine for privacy reasons in the screenshot).

Amend last commit

Of course, I'm sure you already know this, but don't try to combine or amend commits that are already pushed to remote, or your next push will fail miserably.

As an extra bonus, you'll get the benefits of overlay icons when browsing your working copy in Explorer.

Explorer icons