scripts: Add add-upstream-remote script

To be symlinked with bin/add-upstream-repo in
case you need both

Signed-off-by: Andrei Jiroh Eugenio Halili <andreijiroh@madebythepins.tk>
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-02-20 08:19:17 +08:00
parent 9a3ec9da4a
commit d4f0538b47
Signed by: ajhalili2006
GPG Key ID: A30EBE40AD856D88
1 changed files with 11 additions and 0 deletions

11
bin/add-upstream-remote Executable file
View File

@ -0,0 +1,11 @@
#!/bin/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 fetch --all
elif [[ ! -f "$PWD/.git/config" ]] && [[ $1 != "" ]]; then
echo "Is this an git repository? I doubt."
else
echo "Usage: ${0} <git-url>"
fi