find all unreferred commit in git?
I suspect I have performed an incorrect amendment (B') of last commit (B), which cause all my work in the开发者_Go百科 last commit (B) gone.
A
|
B [master]
amend to
A
/ |
B B'
[master]
I think if I haven't do any git gc, my original "correct" commit (B) should still in the repository. However, because it is not referred directly/indirectly by any ref, I cannot find it out. Is there any way that I can list out such kind of "unreferred" commit in git so that I can retrieve my work from that commit?
Thanks
Yes, the reflog is what you're looking for. The reflog keeps a record of the previous value of a branch every time the branch HEAD changes.
精彩评论