avatar Bipul Raman Engineer | Speaker

Keeping a fork up-to-date on GitHub
Posted by Bipul Raman on August 28, 2018.

When you are contributing to an open source repository on GitHub, you are allowed to make pull request only through forked repository. In that case, you will always need to keep your fork updated/in-sync with origin/master. You can follow below approach through command line to do that:
  1. Clone your fork from Origin
    git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
  2. Jump to the root directory of your cloned fork
    cd {cloned fork path} e.g. cd D:\cloned\fork-repo
  3. Add remote from original repository in your forked repository
    git remote add upstream https://github.com/ORIGINAL-USERNAME/REPO-YOU-FORKED-FROM.git
    git fetch upstream
  4. Updating your fork from original repository to keep up with their changes
    git pull upstream master