If all I have to go on is a reference, i.e. refs/heads/my-branch, how can I convert that to the actual branch name, i.e. my-branch, without first checking out the repository?
I've tried git rev-parse --abbrev-ref refs/heads/my-branch which works, however this only will work if i've checked out the repository in the first place, which I haven't done.
Basically i'm recieving refs/heads/my-branch from CI, and then I need to go clone that repository at that branch. But I can't do git clone myrepo -b refs/heads/my-branch, because that's invalid, it wants the actual branch name.
How can I work around this?