]> git.phdru.name Git - git-scripts.git/commitdiff
Fix(fork): Add remote origin if it doesn't exist in an existing repo
authorOleg Broytman <phd@phdru.name>
Fri, 27 Oct 2017 00:50:13 +0000 (03:50 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 27 Oct 2017 00:50:13 +0000 (03:50 +0300)
fork

diff --git a/fork b/fork
index 146cde45fe6e30096f038b4b0680e97cce5b0d5c..7782b8977b71eef17f2e8816f003f7b134b6da74 100755 (executable)
--- a/fork
+++ b/fork
@@ -14,8 +14,8 @@ if [ -d "$local_repo"/.git ]; then
 fi &&
 
 if [ -d .git ]; then
-   git remote add upstream "$upstream" &&
-   git remote set-url origin "$origin"
+   git remote add upstream "$upstream"
+   git remote set-url origin "$origin" || git remote add origin "$origin"
 else
    git clone -o upstream "$upstream" "$local_repo" &&
    cd "$local_repo" &&