Skip to content

Instantly share code, notes, and snippets.

@joechrysler
joechrysler / who_is_my_mummy.sh
Last active May 14, 2024 12:26
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works: