Last active
May 2, 2018 17:55
-
-
Save Sam-Gram/fe9df19e6ba1779cedbe824fd401992a to your computer and use it in GitHub Desktop.
How I eventually fixed a 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
# All commands start in project root | |
# Get back corrupted objects | |
git fetch -p | |
git unpack-objects < <new clone of remote>/.git/objects/pack/pack-<hash>.pack | |
#.get rid of empty files if git fsck isn't working or just in general | |
cd .git; find . -type f -empty -delete -print | |
# Find problems (anything other than dangling commit/object is a problem) | |
git fsck | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment