Question

I cannot find some of my commits in git log, but I can see it using git show the-SHA1-of-commit, or in reflog. I appreciate if someone know how to retrieve these commits. My team made our own git server using gitblit, and there're some commits like "merge branch 'master' of http://example.com..."

enter image description here

Was it helpful?

Solution

Thanks for Chronial's tip, I've learned the useful command

git reflog

which will give you a good history of what's been happening on the head of your branches, you can find the lost commit in the lists, and then

git cherry-pick

can get the lost work back.

via http://ocpsoft.org/tutorials/git/use-reflog-and-cherry-pick-to-restore-lost-commits/

OTHER TIPS

In my case, the branch was merged and hence deleted.

In VS code git status and git fetch returned "everything fine", and you could see a problem only after selecting see git log after pushing thru VS code GUI failed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top