Search code examples
gitfsck

git fsck -- If this is clean then is git repo in good shape? (I put my repos in dropbox and want to check integrity)


I accidentally put my repositories in dropbox.

One of my repositories I couldn't do git status without a message about a missing tree. (git fsck also reported this)

On the other ones I did git fsck and there was just dangling objects and commits. If git fsck is clean or just has dangling objects/commits am I safe?


Solution

  • "Dangling commits" and similar for objects indicates that the repository itself is not broken. It's possible that you've lost a commit or two off some branch, but if so, the repository itself is at least consistent. Check the tip commit of each of your branches1 to see if the last commit is what you expect. (Repeat with your remote-tracking names if applicable, although here you can just use git fetch to fix things).


    1E.g., for each branch, run git show name. Or, git log --no-walk --branches will list out each branch tip commit.