-
-
Save securibee/a2887b429ea435f92d34ccf4584c83b0 to your computer and use it in GitHub Desktop.
Discard previous commit and force push to remote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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