Git show parent branch
When using multiple git branches it can happen, that you loose track of which branch tracks which other. Or maybe even whether branches track any branch. Here is a nice little script to show the ones that track another remote branch and which:
git for-each-ref --format='%(refname:short)' refs/heads/* | while read b; do if r=$(git config --get branch.$b.remote); then m=$(git config --get branch.$b.merge); echo "$b -> $r/${m##*/}"; fi; done
Which results in:
master -> origin/master
dev -> origin/dev