Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git branch --contains errors "no such commit", while github shows that commit exists

Tags:

git

github

I want to check what branches contains this github commit.
So i performed following terminal spells on one of my boxes running git version 1.9.5.msysgit.1:

git clone [email protected]:npm/npm.git && cd npm
git branch -a --contains 5ff786ae103161465d84ecdfdc5b0cfd8839eac8

Surprisingly, I'm getting error that such commit does not exist at all:

error: no such commit 5ff786ae103161465d84ecdfdc5b0cfd8839eac8

How this can happen if github shows this commit?

like image 730
grigoryvp Avatar asked Jul 31 '26 14:07

grigoryvp


1 Answers

As we figured out this is due to the fact that github shows you in a weired way an orphaned commit. Actually they performed some history rewriting and the commit got kicked out of the official history. But it is still reachable, if you perform a

$ git log --all -grep="Sort actions by dependency order"

you still find the correct commit.

like image 76
ckruczek Avatar answered Aug 02 '26 03:08

ckruczek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!