#!/usr/bin/env bash # # workon :: clones a git repo to ~/desk/ and sets the remotes # appropriately # # Original author: https://github.com/sumitsu GITHUB_USER=bsima GITHUB_WORK=${2:-LiaisonTechnologies} DESK="${HOME}/work/${GITHUB_WORK}/" # or wherever you typically put your code echo "${REPO}" if [ ! -d "${DESK}/${REPO}" ] then if ( ! git clone git@github.com:${GITHUB_USER}/${REPO}.git ${DESK}/${REPO} ) then echo "FAILED" exit 1 fi else echo "(already exists)" cd "${DESK}/${REPO}" exit 1 fi; cd "${DESK}/${REPO}" git remote add upstream git@github.com:${GITHUB_WORK}/${REPO}.git git config branch.master.remote upstream git config branch.master.merge refs/heads/master git config remote.pushDefault origin git remote -v exit 0;