Created
July 3, 2014 09:58
-
-
Save dkirrane/47c6856d060e19108315 to your computer and use it in GitHub Desktop.
Find the parent branch of the current branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current_branch=`git rev-parse --abbrev-ref HEAD` | |
git show-branch -a | grep '*' | grep -v $current_branch | 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
Just in case anyone else finds this, I wondered how
2>nul
worked - it should2>/dev/null
;2>nul
creates a file callednul
!