Last active
March 31, 2022 10:24
-
-
Save tiagojdf/2f84a47033d0e7aaae42d93268a77578 to your computer and use it in GitHub Desktop.
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
# General clean up commands. | |
``` | |
find . -type f -empty -delete | |
git fsck --full | |
git gc --aggressive --prune=now | |
``` | |
# Dealing with bad ref head | |
``` | |
tail .git/logs/HEAD # from http://git.661346.n2.nabble.com/corrupted-Git-repository-td6498902.html | |
git update-ref HEAD <hash> # from https://stackoverflow.com/questions/11706215/how-to-fix-git-error-object-file-is-empty | |
``` | |
#For git file is empty loose object corrupt | |
https://stackoverflow.com/questions/4254389/git-corrupt-loose-object | |
``` | |
find .git/objects/ -size 0 -exec rm -f {} \; | |
git fetch origin | |
``` | |
# git pull fails 'error: refs/stash does not point to a valid object!' | |
https://stackoverflow.com/questions/20663239/git-pull-fails-error-refs-stash-does-not-point-to-a-valid-object | |
``` | |
rm .git/refs/stash .git/logs/refs/stash | |
git stash | |
``` | |
#When a rebase is stuck, go to a known point and: | |
https://stackoverflow.com/questions/55045740/stuck-in-a-git-rebase-how-to-reset | |
``` | |
rm -rf .git/rebase-merge | |
``` | |
If the problem is with stash | |
``` | |
git stash clear | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/4254389/git-corrupt-loose-object#