Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
When a rebase is stuck, go to a known point and:
`rm -rf .git/rebase-merge`
https://stackoverflow.com/questions/55045740/stuck-in-a-git-rebase-how-to-reset
For git file is empty loose object corrupt
find .git/objects/ -size 0 -exec rm -f {} \;
git fetch origin
https://stackoverflow.com/questions/4254389/git-corrupt-loose-object
# 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
```
@Tiagojdferreira

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment