dotfiles/bin/add-upstream-remote

12 lines
373 B
Bash
Executable File

#!/bin/env bash
if [[ -f "$PWD/.git/config" ]] && [[ $1 != "" ]]; then
UPSTREAM_REPO_URL=$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" ]]; then
echo "Is this an git repository? I doubt." && exit 1
else
echo "Usage: ${0} <git-url>"
fi