dotfiles/.local/bin/scripts/git-fork

14 lines
352 B
Bash
Executable File

#!/bin/sh
# Clones a fork and sets a corresponding upstream
# ARGS
# - repo name
# - upstream user
# - local user
# - url
# - target directory name (and further arguments to clone)
set -e
git-get "${4:-github.com}" "$1" "$3" "${@:5}"
cd $(expr "$5" \| "$1")
test "$2" && git remote add upstream "$(git-repo "${4:-github.com}" "$1" "$2")"
git remote -v