# A helper script to fork a github repository

## Features

After running the script you'll have the following setup:

 - The source repo is forked and remotes are renamed: source remote becomes *theorchard*
   by default, your remote becomes *origin*.
 - When you're on the *master* branch, the default remote is origin.
 - When using `git pull` on the *master* branch, with no remote and branch specified,
   use the default remote (*theorchard* by default) and merge in the changes from
   the remote master branch.
 - The source repository's *master* branch is protected from accidental push
   (by using intentionally erroneous remote URL).


## Requirements

 - Bash
 - Git
 - [hub](https://github.com/github/hub#installation)


## Usage

    ./fork_orchard_repo.sh repo_name [github_user_name]

Example result:

```
$ ./fork_orchard_repo.sh docs
[...]
origin	git@github.com:mikek/docs.git (fetch)
origin	git@github.com:mikek/docs.git (push)
theorchard	git@github.com:theorchard/docs.git (fetch)
theorchard	do-not-push-here (push)
```

Your GitHub username is taken form the .gitconfig by default.

Environment vars for additional tuning:

 - `SRC_GITHUB_USER` - the GitHub user account name to fork from, defaults to *theorchard*
 - `SRC_REMOTE_NAME` - the remote name to use in your local repository, defaults to `SRC_GITHUB_USER`
