Add 'get remote'

This commit is contained in:
William Hilton 2015-12-10 19:38:23 -05:00
parent 3dc4ac21fa
commit 4461dd9157

14
bin/get
View file

@ -242,7 +242,10 @@ else
# Check for multiple remotes
remote_count=$(git remote show | wc -l)
remotes=$(git remote show | tr '\n' ' ' | sed 's/\s*$//g')
if [ "$remote_count" = "1" ]; then
if [ "$remote_count" = "0" ]; then
echo "No remotes configured yet"
exit
elif [ "$remote_count" = "1" ]; then
# If only one remote
remote="$remotes"
else
@ -257,6 +260,15 @@ else
fi
;;
remote)
read -ep "What is the URL for this remote repo?: " remote_url
read -ep "Choose an alias for this remote [origin]: " remote_alias
if [ "$remote_alias" = "" ]; then
remote_alias="origin"
fi
git remote add "$remote_alias" "$remote_url"
;;
clone)
# Github username, if available
github_user=$(git config github.user)