January 12, 2012
While it is easy to create forks of other projects through Github, it isn’t as easy to update your fork from the parent repository. The following steps are what I do to update my fork. These steps assume that you have a local copy of the repository and that everything is up to date and committed.
First you need to add a remote to the repository you forked.
$ git remote add --track <branchname> <projectname> git://github.com/<gitmember>/<project>.git
originfor your forked instance of the project, so call it something other than
To see that the remote was successfully added you can run
$ git remote -v
which will show all the remotes your local repository currently has.
Next you want to fetch all the changes from the newly added remote.
$ git fetch <projectname>
projectname is the name you assigned to the remote above.
This fetch operation will create a new branch in your repository called
projectname/branchname. With that in place you are ready to merge.
$ git merge projectname/branchname
That’s all there is to updating your fork from the parent repository.