Suppose a remote that references a remote repository is called origin . In this case, first update all branches of the remote tracking using
git fetch origin
Now you can use the useful --contains option for git branch to find out which of the remote branches contains this commit:
git branch -r --contains xyz
( -r means only show remote tracking branches.) If commit xyz contained in one or more remote tracking branches, you will see output, for example:
origin/test-suite origin/HEAD -> origin/master origin/master
If it is contained in your local repository, but is not one of the branches of remote tracking, the output will be empty. However, if this commit is not known at all in your repository, you will get a malformed object name error message and a usage message - maybe a little confusing if you don't expect this ...
Mark Longair Apr 05 '11 at 9:01 2011-04-05 09:01
source share