threads / discuss / 21097

search branches which contain a blob id

Subject: search branches which contain a blob id

## tl;dr

2 messages between Sep 30, 2009 and Sep 30, 2009.

replies: 1people: 2as markdown or json

Reto Glauser· Sep 30, 2009, 12:38 UTC · lore
To get a list of branches which contain a specific commit we use:
$ git branch --contains <commit id>

Is there a similar way to get a list of branches with respect to a specific blob (e.g. the actual code change a commit introduces)?

Obvious use-case: One isn't interested in the commit information (author, parent, date) but merely in the set of changes a commit introduces.

Tomas Carnecky· Sep 30, 2009, 13:43 UTC · re: Reto Glauser · lore

Re: search branches which contain a blob id

On Sep 30, 2009, at 2:38 PM, Reto Glauser wrote:
Show 6 quoted lines
> To get a list of branches which contain a specific commit we use:
>
> $ git branch --contains <commit id>
>
> Is there a similar way to get a list of branches with respect to a
> specific blob (e.g. the actual code change a commit introduces)?

Blob == contents of a file. To see what code changed you need to compare two blobs (or trees).

> Obvious use-case: One isn't interested in the commit information  
> (author,
> parent, date) but merely in the set of changes a commit introduces.
git log -S'string to search for'

searches the history for commits which introduced or removed that string from a file.

Or 'git log -p', if you want to see the diff alongside the other information that log gives you.

tom

← back to recent threads