guettli
guettli

Reputation: 27129

Github: Show branches which contain a commit

If you look at a commit via github web GUI for example: b2d273a2fdc83e9b1d270895e253b55a813163d9

I know how I can list all branches which contain this commit on the command line:

git branch --contains <commit>

Is there a way to do this (list branches containing this commit) via the web GUI of github?

Upvotes: 9

Views: 1159

Answers (3)

sschuberth
sschuberth

Reputation: 29866

There's a trick you could probably use, esp. for your use-case of checking whether a fix / commit is in a release (and thus was merged via a PR, in a proper workflow):

You can search for a commit's SHA1 on the "Pull requests" tab in the "Filters" field, just paste the SHA1 there. If there is an open or closed PR that contains that SHA1, it will show up in the search results.

Upvotes: 4

n8henrie
n8henrie

Reputation: 2975

Currently the GitHub web interface for a given commit shows you the branches that contain that commit.

For example, I was just looking to see if my (merged) PR to nixpkgs has yet been merged into nixpkgs-unstable (as of time of writing it hasn't -- it's only in master as you can see):

PR only in master

We can compare that to another commit to the same repo which has been merged into several other branches:

PR merged into other branches

If you expand the ... you'll see a list of several other branches containing that commit.

Upvotes: 3

VonC
VonC

Reputation: 1329512

This is not a feature I have ever seen on the GitHub web interface directly.
I only know it through my 2009 answer which was linked in the comments above, but it does not apply to your question.

You have dedicated URLs for comparing commits, but not for listing branches including a given commit.

One alternative/workaround on GitHub website would be to use a GitHub Action triggers by a pull request: the action script would then list the branches which include the commit from which you are doing a PR (to a dedicated dummy branch of your repository), since you can do such a PR directly from GitHub web UI.
But that seems a bit far fetched.

Upvotes: 1

Related Questions