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