#! /bin/sh if [ -z "$2" ]; then echo "Usage: $0 upstream origin" >&2 exit 1 fi upstream="$1" origin="$2" local_repo="`basename \"$origin\" .git`" git clone -o upstream "$upstream" "$local_repo" && cd "$local_repo" && pwd >> "`dirname \"$0\"`"/locate-all.list && git remote add origin "$origin" && chmod a-x .git/config && branch="`git branch | awk '/^\*/ {print $2}'`" && git pull origin $branch && git push -u origin && git config branch.$branch.remote upstream && git config branch.$branch.remotepush origin && git config branch.$branch.merge refs/heads/$branch && git config push.default current && exec git gc --aggressive