Sublime Forum

How to know branches that contains commit in SublimeMerge?


Hi, I’d like to know what’s the “idiomatic way” to know the branch(es) that contains the commit I’m on, ie:

git branch --contains <commit_hash> -a or git tag --contains <commit_hash>, is there any shortcut to figure out that type of information?

Or asked differently, let’s say I’ve found a commit after using the search dialog… how do i know which branch owns this commit straightaway so i can create a local branch? (I don’t mean create a local branch from that particular commit but for the particular branch that contains it)

Thanks in advance



I think you hit the nail on the head in your own question; if you want to know what branch contains a commit, you need to ask git to trace the graph using the command that you outlined above. I’m not aware of anything in Merge that would do it for you otherwise.

The quickest way to do so would be to add an item for it to the context menu; an example of how to do that is linked below. You should also be able to bind the command to a key as well, though $commit expands out to the commit hash 000000 if you don’t have a commit selected.

The second linked post covers the same thing, but includes a screenshot that shows where you can see the output, in case you’re not already familiar with that.



Here’s an alternative solution for finding the branches that a commit belongs to, given to me by a Sublime team member:



Oops, didn’t realize that @OdatNurd’s reply had essentially the same thing. My bad.