Randnum
Randnum

Reputation: 1360

git command to show branch/feature name from a sha1 hash

How do I get the branch/feature name from a sha1 hash on the command line?

Also how is this done using pretty=format syntax.

I see that it's done somehow using this method

git log --graph --full-history --all --color \  
--pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"

but I don't know which line is causing this.

Upvotes: 3

Views: 602

Answers (1)

alex
alex

Reputation: 490497

How do I get the branch/feature name from a sha1 hash on the command line?

You can use...

git branch --contains <sha1>

Upvotes: 2

Related Questions