Skip to main content
1 of 9
Chris Johnsen
  • 221.5k
  • 26
  • 212
  • 187

You can do this fairly easily without git rebase.

If you want to write the new commit message from scratch, thus suffices:

git reset --soft HEAD~3 &&
git commit

If you want to start editing the new commit message with a concatenation of the existing commit messages (i.e. similar to what a pick/squash/squash/…/squash git rebase -i instruction list would start you with), then you need to extract those messages and pass them to git commit:

git reset --soft HEAD~3 && 
git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
Chris Johnsen
  • 221.5k
  • 26
  • 212
  • 187