I have a commit xyz in my local branch that I want to check if it is included in a remote release repository; can I do that in some easy way? I could clone the remote repo, but I’m hoping for a nicer+faster way. git ls-remote seemed promising, but found nothing of value to me there. Thanks!
I have a commit xyz in my local branch that I want to check
Share
Let’s suppose that the remote that refers to the remote repository is called
origin. In that case, first update all your remote-tracking branches with:Now you can use the useful
--containsoption togit branchto find out which of the remote branches contains that commit:(The
-rmeans to only show remote-tracking branches.) If the commitxyzis contained in one or more of your remote-tracking branches, you’ll see output like:If it’s contained in your local repository, but not one of the remote-tracking branches, the output will be empty. However, if that commit isn’t known in your repository at all, you’ll get the error
malformed object nameand a usage message – perhaps a bit confusing if you’re not expecting it…