Skip to main content
Code and think

GIT Autosquash

For this to work well, you first need to have autosquash enabled. To do that use git config rebase.autosquash true.

If we want to fix some existing commit, then we use fixup: git commit --fixup 23bu43i. The last parameter is SHA of a commit that we are fixing.

Alternatively, you can use git commit -m "!fixup: original commit message".

Another option is to use sqash instead of fixup. This one will preserve both commit messages.

Reference