Skip to content

Instantly share code, notes, and snippets.

@benrowe
Last active October 16, 2017 02:39
Show Gist options
  • Save benrowe/6aab5877ea3f35c85e52b57650c9a8d1 to your computer and use it in GitHub Desktop.
Save benrowe/6aab5877ea3f35c85e52b57650c9a8d1 to your computer and use it in GitHub Desktop.
Based on the currently checked out branch, find where it branched from
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