0 votes
1 view
in Devops and Agile by (20k points)

How can I query git to find out which branches contain a given commit? gitk will usually list the branches unless there are too many, in which case it just says "many (38)" or something like that. I need to know the full list, or at least whether certain branches contain the commit.

1 Answer

0 votes
by (28.4k points)

The following command should do the magic: 

$ git log <SHA1>..master --ancestry-path --merges --oneline -1

Here, sha1 is the shorthand version of commit ID

You can get that by using the following command:

$ git show -s --format=%h

To see the full commit ID use this:

$ git show -s --format=%H

Welcome to Intellipaat Community. Get your technical queries answered by top developers !