Well there are about a million commands you can use to do this, but the notes on GitHub.com unfortunately create merges which are bad, bad when you are trying to maintain things, here is what they suggest:
- Fork from the GitHub.com repo, for example if you have a repo `https://github.com/altercation/solarized` to pick on the really cool solarized repo and you want to make a fork to say `https://github.com/richtong/solarized` just choose fork from the so called upstream.
- Now on at the command line, you can clone your own repo with
git clone email@example.com:richtong/solarized
cd solarizedto get into that new repo
- From here you can now create your now branches, say
git checkout -b rich-skinnedif you want to say add your own custom skin.
Now here comes the tricky part, how do you first make sure your
origin/master that is your fork is up to date:
- First you want to declare the upstream with
git remote add upstream https://github.com/altercation/solarizedwhich gives your local repo two places to push things origin which is your fork and upstream which is the source of your fork.
- Now when you want to sync your fork, the best command is to first
git fetch upstream --prunewhich your local machine with all the data in https://altercation/solarized and also
git fetch -prunewhich does the same for your fork’s in the cloud master.
- Then you can sync it with
git rebase upstream/masterwhich says take all your changes and put them at the top of the upstream/master, you should then need to do a
git push -fto fork the change as it is rewriting the history but you will not have merges and you will not have rebase problems by doing this.
- After you do this, you may want to simplify your many commits with
git rebase upstream/master -ibecause this will put in an interactive dialog and you can squash various commits together and fix the edit names. If these look good then
git push -fwill commit the rewrite to your branch and you are up to date with upstream/master
- If you also want you can
- As an aside this makes it easy to do a pull request when you need to update the upstream because all your changes “bubble” to the top and then it is easy to do pull requests.