How can I get the associated ref path for a git SHA?
- by andreb
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