7

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?

guettli
  • 25,042
  • 81
  • 346
  • 663
  • 1
    Please let me know why you think this question deserves a down-vote. – guettli Nov 06 '19 at 12:57
  • 1
    Please visit this answer: https://stackoverflow.com/a/1419637/3465242 – Ashu Nov 06 '19 at 13:25
  • 2
    @Ashu I highlighted the important part of the question: **via the web GUI of github** – guettli Nov 06 '19 at 13:26
  • I'm sorry to ask, but what's the intention to do this via WebUI? This could be helpful to suggest other solutions or workarounds. – Patrick Pötz Nov 07 '19 at 08:41
  • 2
    @PatrickPötz Here is my intention: I want to know if a fix is in a release and I don't have checked out this repo. – guettli Nov 07 '19 at 08:57
  • @PatrickPötz Here is my intention: I want to know if a fix is in a release and I don't have checked out this repo. I could compare the files, that is too much "searching with the eyes". Related: https://github.com/guettli/programming-guidelines/blob/master/README.md#avoid-searching-with-your-eyes – guettli Nov 07 '19 at 09:03
  • I understand where @guettli is coming from. Not all Developers like to use the command line. And those who do still may not want to clone a repo when doing quick research on the history of a commit (especially if that repo is large or their internet connection is throttled or limited data usage). – benhorgen Nov 07 '19 at 15:00
  • 1
    @benhorgen thank you. I feel understood now. I am a developer and could easily clone the repo on the command line. But nowadays other users edit files via github. Maybe some newcomer which edits markdown files. – guettli Nov 07 '19 at 15:37

3 Answers3

4

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.

sschuberth
  • 28,386
  • 6
  • 101
  • 146
  • A solution is better than a work-around. But a work-around is better than nothing. Thank you for this answer! – guettli Nov 12 '19 at 08:37
  • 1
    BTW, the commit b2d273a2fdc83e9b1d270895e253b55a813163d9 you're looking for seems to have been changed slightly and actually is contained as c521d8e27cefab847a709d07f54786ced08fb196 in `master`. – sschuberth Nov 12 '19 at 09:13
2

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.

n8henrie
  • 2,737
  • 3
  • 29
  • 45
1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250