We have configured one git repository, this repository contains more branches. Recently we faced one issue, we lost a few commits which are pushed from user clone from the repository.
If I run "git log commitid" I can able to see the commit id information, but git branch --contains commitid" doesn't show the branch it belongs to .
Also If I run describe it results below, I ran fsck all options, but looks liet these commits are not tangling commits. Please share your thoughts, why this commits are missing and not attached with any branch.
git describe commitid --all
changes/01/21112/1
I ran git reflog , but it doesn't show that commit id , we actually cherry-picked the commit from one commit, now I can see the actual commitid (even this commit also not belongs to any commit) and cherry-picked commit id corresponding to actual commit id is missing, I am not able to trace out the cherry-picked commit id
How can I find the lost cherry-picked commit id ?
Did you try git reflog?
When a commit is unreferenced, for example, with git reset, it is actually kept in the repository for some time and even git gc won't collect it. That's because they are kept referenced in the reflog.
You can see if this is the case with:
$ git fsck --no-reflogs
The reflog is here to protect you. It allows you to roll back a disastrous reset, rebase, or any other command that changes history.
If you want to recover these lost commits, you can get them from the reflog easyly enough.
If you want to delete them for good, you can use something like:
$ git reflog expire --all
But beware! That may not be undone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With