Skip to content

Instantly share code, notes, and snippets.

@agusbrand
Last active June 13, 2021 21:35
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 agusbrand/99e8d6852f58a9a479f12409e776660b to your computer and use it in GitHub Desktop.
Save agusbrand/99e8d6852f58a9a479f12409e776660b to your computer and use it in GitHub Desktop.
How to squash commits

How to squash commits

1. Rebase using interactive editor. N = last N commits to be squashed into one commit.

 > git rebase -i HEAD~N

2. Let the first commit marked with "pick". Then "squash" the rest. Use "fixup" to discard that particular commit message.

3. Force push

 > git push --force-with-lease
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment