Is there a way to find out what branch a commit comes from given its SHA-1 hash value?
Bonus points if you can tell me how to accomplish this using Ruby Grit.
To find the local branch:
grep -lR YOUR_COMMIT .git/refs/heads | sed 's/.git\/refs\/heads\///g'
To find the remote branch:
grep -lR $commit .git/refs/remotes | sed 's/.git\/refs\/remotes\///g'