Skip to content

Instantly share code, notes, and snippets.

@Larusso
Created April 17, 2014 21:43
Show Gist options
  • Save Larusso/11013283 to your computer and use it in GitHub Desktop.
Save Larusso/11013283 to your computer and use it in GitHub Desktop.
Clone a fork of a repository and setup the upstream remotes to follow the upstream repository.
git config --global alias.clone-fork '!sh -c "[ $# = 3 ] && git clone $1 $3 && cd $3 && git remote add upstream $2 && git fetch upstream && git checkout -b upstream_master --track upstream/master && git co @{-1} && exit 0 || echo \"usage: git clone-fork <fork-repository> <upstream-repository> <directory>\" >&2 && exit 1 "' -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment