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

StackOverflow https://stackoverflow.com/questions/22982630

  •  01-07-2023
  •  | 
  •  

سؤال

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

هل كانت مفيدة؟

المحلول

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/

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top