How can I get the associated ref path for a git SHA?
Posted
by andreb
on Stack Overflow
See other posts from Stack Overflow
or by andreb
Published on 2010-03-28T08:54:12Z
Indexed on
2010/03/28
9:03 UTC
Read the original article
Hit count: 285
Hi,
I want to be able to pass anything to a git command (maybe its a SHA, maybe it's just something like "origin/master" or "devel/epxerimental" etc.) and git tells me the ref path of the branch that the passed something lives in, e.g.
<git_command> 0dc27819b8e9 => output: refs/heads/master
<git_command> xyz/test => output: refs/remotes/xyz/master
...
I've been looking at git show
or git log
or git rev-parse
and apart from --pretty=format:%d
I couldn't find anything.
(--pretty=format:%d
output is quite strange with lotsa free space and empty lines and sometimes more than one ref paths are on one line bunched together).
There has to be a better way?
Thanks for reading.
Andre
© Stack Overflow or respective owner