Skip to content

Instantly share code, notes, and snippets.

@jdforsythe
Created December 5, 2019 21:54
Show Gist options
  • Save jdforsythe/c149221ba21d28c0b501772284d6ffba to your computer and use it in GitHub Desktop.
Save jdforsythe/c149221ba21d28c0b501772284d6ffba to your computer and use it in GitHub Desktop.
Git find parent branch
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment