Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Missing Commit error

Tags:

git

We recently changed the location of a repository, and we discovered a months-old commit is missing from the files. The old server we had the Git on is down, so there is no chance of recovering the commit from there.

Here's the error I get:

$ git fsck --full
broken link from commit 58ba71d080b1814420bce09c4e505b323fd9cb58
to commit a2e2bde363032b7609616a3152fe048cc5c83715

missing commit a2e2bde363032b7609616a3152fe048cc5c83715

Is there anything that can be done to fix this? Thank you!

like image 653
Albert Iordache Avatar asked Nov 06 '22 02:11

Albert Iordache


1 Answers

Every clone has full history so anyone who worked on that project since the commit was published should have it on their computer. Look inside anyone's working directory for the commit then add it's packs and objects (content of the .git/objects directory) to the broken repository (only files that don't exist), fsck again and repack.

It's not possible to reconstruct the object if you don't find it anywhere.

like image 53
Jan Hudec Avatar answered Nov 15 '22 04:11

Jan Hudec