Github, Updating a forked repo with latest code

  • Anime Lovers

    I've had trouble in the past trying to contribute to projects in Github because while I am working on code in my forked project, they make updates and I am unable to find an easy way to update my repo with their latest code additions.

    Does anyone have any idea on how to actually do this?

  • GNU/Linux Admin

    Yes, when you check out your forked repo to your local fs, also add the upstream remote as well:

    $ git remote add upstream

    Then if you want to merge upstream changes in:

    $ git fetch upstream    # Pull latest changes from our repo
    $ git checkout master   # Switch to your branch (if you haven't already)
    $ git merge upstream/master
  • Anime Lovers

    Thanks! That is very helpful.

Suggested Topics

| | | |