Pulling changes into a Github fork from the original repository

If you maintain your own ongoing fork of a project on Github, you will inevitably want to pull in changes from the originator’s repository. Here’s how I usually go about it.

First add the other guy’s repository to your list of remotes:


cd my-fork
git remote add other-guy https://github.com/other-guy/other-guys-repo.git 

If you were to then list your remotes, you would have something like:


origin
other-guy 

Now it’s just a case of pulling from the relevant branch on their repo, in this case ‘master':


git pull other-guy master

Hope that saves someone some time.

Published by

Jamie

Hi, I am the Managing Director of SonicIQ Limited in the UK. I have been working in the web development industry since 1999 and have been running SonicIQ since 2001. Currently Ruby On Rails is my preferred development platform. I am experienced in designing with web standards, HTML5, CSS3 and Javascript.

5 thoughts on “Pulling changes into a Github fork from the original repository”

  1. Roger:

    Theoretically you could do the exact same thing:

    cd original-repo
    git checkout master
    git remote add other-guys-fork https://github.com/other-guy
    git pull other-guys-fork master

    But you probably want to have other-guy create a Pull Request in your fork instead and just use Github to do this for you.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>