track your forks

April 14, 2017 by ben

git

The day i discovered github.com, i was amazed about how many projects there are. I started to contribute to some projects, which led quickly to this behaviour:

Fork all the things

So now i have all these forks which are not updated with the latest commits from upstream. Happily there is an easy 4-step solution for this:

  1. Clone your fork:

    git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

  2. Add git remote from original repository to your forked repository:

    cd into/cloned/fork-repo

    git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git

    git fetch upstream

  3. Update your fork from original repo to keep up with their changes:

    git pull upstream master

  4. push back changes to your repo:

    git push

© 2017 diffus.org