1

When I am in my local repo and do

git show <commit-SHA>

it shows me the commit and its associated file changes.

But git does a search across all branches in the repo, not just the branch I am currently in. How do I get it to display in which of the local branches that commit is located?

amphibient
  • 29,770
  • 54
  • 146
  • 240
  • Do you want to know which branches can trace their lineage back to include that commit? – user229044 Jan 11 '14 at 00:27
  • possible duplicate of [How to list branches that contain a given commit?](http://stackoverflow.com/questions/1419623/how-to-list-branches-that-contain-a-given-commit) – Joe Jan 11 '14 at 01:18

1 Answers1

4

If you want to know which branches contain a commit, you can use

git branch --contains COMMIT_ID

This will show you all branches that an trace their history back to the given commit.

As an aside, git doesn't do a "search across all branches" to find a commit for git show; The point of the SHA1 sum is that Git can go immediately to the object in question because its content can never change.

user229044
  • 232,980
  • 40
  • 330
  • 338