Created
July 29, 2012 16:41
-
-
Save nahurst/3200127 to your computer and use it in GitHub Desktop.
Recovering from corrupted Git
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
Get the previous commit hash from the last line of .git/logs/HEAD | |
Replace .git/refs/heads/yourbranch with it | |
"git status" should now work. Note the files changed (you will copy them later) | |
Push this repo elsewhere (a different branch on origin) | |
Remove the .git directory | |
Pull that repo back out to a different directory | |
Copy over the noted files to that directory | |
Commit them |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment