bin: Update add-upstream-remote script

Signed-off-by: Andrei Jiroh Eugenio Halili <andreijiroh@madebythepins.tk>
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-03-28 20:34:12 +08:00
parent 19543d4b75
commit 3609a52700
Signed by: ajhalili2006
GPG Key ID: A30EBE40AD856D88
1 changed files with 3 additions and 3 deletions

View File

@ -1,10 +1,10 @@
#!/bin/bash
#!/bin/env bash
if [[ -f "$PWD/.git/config" ]] && [[ $1 != "" ]]; then
UPSTREAM_REPO_URL=$1
git remote --verbose add upstream $1 || git remote --verbose set-url upstream $1
git remote --verbose add upstream $UPSTREAM_REPO_URL || git remote --verbose set-url upstream $UPSTREAM_REPO_URL
git fetch --all
elif [[ ! -f "$PWD/.git/config" ]] && [[ $1 != "" ]]; then
elif [[ ! -f "$PWD/.git/config" ]]; then
echo "Is this an git repository? I doubt."
else
echo "Usage: ${0} <git-url>"