Created
December 15, 2011 09:02
-
-
Save marcust/1480427 to your computer and use it in GitHub Desktop.
git-tracking - show information about what the current branch is tracking
This file contains hidden or 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 | |
CURRENT_BRANCH=$(git name-rev --name-only HEAD) | |
REMOTE_REF=$(git config --get-regexp branch.$CURRENT_BRANCH.merge | cut -d' ' -f 2 | sed -e 's|refs/heads/||'); | |
REMOTE=$(git config --get-regexp branch.$CURRENT_BRANCH.remote | cut -d' ' -f 2); | |
if [ -z "$1" -o "$1" = 'branch' ]; then | |
echo $REMOTE_REF | |
fi; | |
if [ "$1" = 'remote' ]; then | |
echo $REMOTE | |
fi; | |
if [ "$1" = 'full' ]; then | |
echo $REMOTE/$REMOTE_REF | |
fi; | |
if [ "$1" = 'name' ]; then | |
echo $REMOTE:$REMOTE_REF | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment