Created
February 12, 2014 19:35
-
-
Save janschumann/8962917 to your computer and use it in GitHub Desktop.
find out which remote branch is tracked by 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
#!/bin/sh -e | |
# find out which remote branch is tracked by the current branch | |
branch=$(git symbolic-ref HEAD) | |
branch=${branch##refs/heads/} | |
remote=$(git config "branch.${branch}.remote") | |
remoteBranch=$(git config "branch.${branch}.merge") | |
remoteBranch=${remoteBranch##refs/heads/} | |
echo "${remote:?}/${remoteBranch:?}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment