How do you get the branch name of a commit hash in Git? Easy, just run this one command:
git rev-parse --abbrev-ref <COMMIT>
And another way to know which branch is the current branch:
git rev-parse --abbrev-ref HEAD
How do you get the branch name of a commit hash in Git? Easy, just run this one command:
git rev-parse --abbrev-ref <COMMIT>
And another way to know which branch is the current branch:
git rev-parse --abbrev-ref HEAD