Created
November 8, 2010 18:12
-
-
Save tebeka/668017 to your computer and use it in GitHub Desktop.
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
_gitsync() { | |
if [ $# -eq 1 ]; then | |
repo=origin | |
else | |
repo=$2 | |
fi | |
branch=$(git branch --no-color | grep '^*' | awk '{print $2}') | |
if [ -z "$branch" ]; then | |
# git will show an appropriate error | |
return 1 | |
fi | |
if [ $repo != origin ] && [ $branch != master ]; then | |
echo "error: refusing to $1 to branch $branch on $repo" | |
return | |
fi | |
echo git $1 --tags $repo $branch | |
git $1 --tags $repo $branch | |
} | |
push() { | |
_gitsync push $1 | |
} | |
pull() { | |
_gitsync pull $1 | |
} | |
complete -W "origin upstream" pull | |
complete -W "origin upstream" push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment