Skip to content

Instantly share code, notes, and snippets.

@zh-f
Forked from jbub/squash-commits.sh
Created May 21, 2018 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zh-f/e7b6ce70fe02120ac96afbe30bd26724 to your computer and use it in GitHub Desktop.
Save zh-f/e7b6ce70fe02120ac96afbe30bd26724 to your computer and use it in GitHub Desktop.
git squash last two commits into one
git rebase --interactive HEAD~2
# we are going to squash c into b
pick b76d157 b
pick a931ac7 c
# squash c into b
pick b76d157 b
s a931ac7 c
# after that just edit the commit message
# This is a combination of 2 commits.
# The first commit's message is:
b
# This is the 2nd commit message:
c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment