How to pull new code from origial repository to a local forked repository

In this thread on Stackoverflow you’ll find an easy method to pull new/updated code from an original repository to your local fork:

# Add this in a terminal in the relevant directory:
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
git fetch upstream

# then: (like "git pull" which is fetch + merge)
git merge upstream/master master

# or, better, replay your local work on top of the fetched branch
# like a "git pull --rebase"
git rebase upstream/master

After adding the upstream you only have to run the merge or rebase command now and then – whenever you know or suppose that the code was updated.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enable Notifications OK No thanks

We use cookies - more information

Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.

Close