Skip to content

Instantly share code, notes, and snippets.

@Rishabh04-02
Forked from tuxfight3r/git-squash
Last active October 7, 2017 15:16
Show Gist options
  • Select an option

  • Save Rishabh04-02/74b5295b0842b5933683f86718a0187b to your computer and use it in GitHub Desktop.

Select an option

Save Rishabh04-02/74b5295b0842b5933683f86718a0187b to your computer and use it in GitHub Desktop.
git squash multiple commits with rebase
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
#then push the forced commit by
git push origin master -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment