Relative Content

Tag Archive for gitbranchgit-branch

Is it possible to get the latest branch name for a git commit that is in several branches

I’m trying to get the branch name for a commit in git.
I’m using the following command:
git name-rev --name-only --always --exclude=tags* HEAD

but if the commit pointed by HEAD contains several branches how can I get the latest that was created from that specific commit
For example, this is the first line of git log command:
commit 4126555537691488d316d911dd881f0haf64ddbe (HEAD, origin/stage, origin/develop, origin/HEAD, stage, develop)
the git name-rev command above always, returns develop, why ?
Can I get all the branches ? can I have a sorted list, somehow ?