Skip to content

Instantly share code, notes, and snippets.

@matiasah
Last active January 30, 2021 02: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 matiasah/68b8770267b3b55b6d53ce20eefab0a5 to your computer and use it in GitHub Desktop.
Save matiasah/68b8770267b3b55b6d53ce20eefab0a5 to your computer and use it in GitHub Desktop.
Squash Pull Request

Reset the current branch to the commit just before the last 12:

git reset --hard HEAD~12

HEAD@{1} is where the branch was just before the previous command.
This command sets the state of the index to be as it would just
after a merge from that commit:

git merge --squash HEAD@{1}

Commit those squashed changes. The commit message will be helpfully
prepopulated with the commit messages of all the squashed commits:

git commit

Force push

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