Skip to content

Instantly share code, notes, and snippets.

View xu20160924's full-sized avatar
🎯
Focusing

xu20160924

🎯
Focusing
View GitHub Profile
@xu20160924
xu20160924 / who_is_my_mummy.sh
Created June 27, 2023 06:49 — forked from joechrysler/who_is_my_mummy.sh
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: