Created
May 1, 2015 13:18
-
-
Save Wolfsblvt/74f4ddba00c03b59eb63 to your computer and use it in GitHub Desktop.
Function to make upstream to "upstream"
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
setupstream = "!f() { \ | |
local rem=$(git remote | grep -v '^origin$') \ | |
if [ \"$(wc -l <<<\"$rem\")\" -gt 1 ]; then \ | |
echo 'Too many remotes.' >&2 \ | |
return \ | |
fi \ | |
if [ -z \"$rem\" ]; then \ | |
echo 'No non-origin remote found.' >&2 \ | |
return \ | |
fi \ | |
if [ \"$rem\" = upstream ]; then \ | |
echo '\"upstream\" remote already exists.' \ | |
return \ | |
fi \ | |
git remote rename \"$rem\" upstream \ | |
}; \ | |
f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment