From 4461dd9157e8851ff37284b01080823b07a62443 Mon Sep 17 00:00:00 2001 From: William Hilton Date: Thu, 10 Dec 2015 19:38:23 -0500 Subject: [PATCH] Add 'get remote' --- bin/get | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/get b/bin/get index 30ea5cf..7543216 100755 --- a/bin/get +++ b/bin/get @@ -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)