Created
March 26, 2012 19:34
-
-
Save greenantdotcom/2208996 to your computer and use it in GitHub Desktop.
How to unf*@# a git push
This file contains hidden or 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
### | |
### DO NOT DO THIS IF YOU ARE NOT COMFORTABLE WITH WHAT YOU ARE DOING. | |
### | |
### ONCE YOU START MAKING FORCIBLE CHANGES ON YOUR LOCAL OR HOSTED REPOS, YOU MAY NOT BE ABLE TO UNDO YOUR UNDOs SO GO SLOWLY AND MAKE URE YOU DO THE RIGHT THING | |
### | |
### ------------------------------------------------------------------ | |
### Reference: http://stackoverflow.com/questions/1270514/undoing-a-git-push#1270608 | |
### | |
### In your Git project's directory, figure out what the last "good" commit is | |
### | |
### Now use that last good commit and force our branch to use that as its HEAD | |
### | |
git reset --hard {LASTGOODCOMMIT} | |
### | |
### And then, given your active branch, push that same change up to the hosted repo | |
### | |
### NOTE: You can also specify a different origin, since for aRes' purposes, origin is going to likely be your fork, and not the master arestravelinc/{PROJECT} | |
### | |
git push -f origin {LASTGOODCOMMIT}:{BRANCHTOFIX} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment