1

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?

Chris Muench
  • 17,444
  • 70
  • 209
  • 362

1 Answers1

1

"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.

torek
  • 448,244
  • 59
  • 642
  • 775
  • If you use `git rebase -i` as much as I do, you'll learn that to get usable output in long run you really want to use `git fsck --no-dangling` instead. Basically all the old commits left behind after rebasing your branches multiple times are technically dangling commits. You can consider those as parts of the repository that *could* be released to reduce disk usage. I prefer to keep those around for longer than the default 90 days so my `git fsck` keeps listing those by default. – Mikko Rantalainen May 24 '21 at 14:49