1. git branch --contains <commit>
$ git branch --contains d590f2
tests
* master
git tag --contains <commit>
git branch --contains <commit>
Only list branches which contain the specified commit (HEAD if not specified). Implies --list.
git branch -r --contains <commit>1.
2. Git: Find the most recent common ancestor of two branches
$ git merge-base branch2 branch3
050dc022f3a65bdc78d97e2b1ac9b595a924c3f2