Safely syncing your git fork to an upstream master

Well there are about a million commands you can use to do this, but the notes on unfortunately create merges which are bad, bad when you are trying to maintain things, here is what they suggest:

  1. Fork from the repo, for example if you have a repo `` to pick on the really cool solarized repo and you want to make a fork to say `` just choose fork from the so called upstream.
  2. Now on at the command line, you can clone your own repo with git clone
  3. Now cd solarized to get into that new repo
  4. From here you can now create your now branches, say git checkout -b rich-skinned if 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:

  1. First you want to declare the upstream with git remote add upstream which gives your local repo two places to push things origin which is your fork and upstream which is the source of your fork.
  2. Now when you want to sync your fork, the best command is to first git fetch upstream --prune which your local machine with all the data in https://altercation/solarized and also git fetch -prune which does the same for your fork’s in the cloud master.
  3. Then you can sync it with git rebase upstream/master which says take all your changes and put them at the top of the upstream/master, you should then need to do a git push -f to 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.
  4. After you do this, you may want to simplify your many commits with git rebase upstream/master -i because 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 -f will commit the rewrite to your branch and you are up to date with upstream/master
  5. 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.