Skip to content

Instantly share code, notes, and snippets.

@securibee
Created April 14, 2020 00:11
Show Gist options
  • Save securibee/a2887b429ea435f92d34ccf4584c83b0 to your computer and use it in GitHub Desktop.
Save securibee/a2887b429ea435f92d34ccf4584c83b0 to your computer and use it in GitHub Desktop.
Discard previous commit and force push to remote
https://stackoverflow.com/a/24659189
Move you branch pointer back to the first commit:
git reset --hard HEAD~
Stage the changes from the previous commit:
git merge --squash HEAD@{1}
Commit your changes, amending them into a single commit.
git commit --amend
Force-push your new single commit to the server:
git push -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment