Search code examples
gitgit-mergegit-push

I cannot find some of my commits in git log, but I can see it using git show, why?


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


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/