Contributing to an open source project on GitHub usually involves the following steps:

  1. Fork the repository to your account

  2. Commit changes to your repo

  3. Open a pull request on GitHub

Simple enough. I had done it a number of times before, but ran into a problem with a forked project today. I had forked the repository some time ago to make some changes which I submitted via pull request. Today I wanted to work on a different thing in the same repository but realized my fork was out of date. The original repository contained new commits my fork did not have yet. I am more used to working with branches within the same repository and would do a merge in this situation. But this time the commits I wanted were on a different repository. As far as I know, there is no way to do it through GitHubs user interface directly. But that is no big deal since the manual steps are quite simple. Here is how to update a forked repository in the easiest scenario:

# Working out of your forked repository
# Your current branch corresponds to branch-name in the original repo
# You have no unique changes in your fork

git remote add source [email protected]:the-repository/you-forked-from
git pull source branch-name
git push origin

The strongest assumption is that You have no unique changes in your fork. If you have, then the solution really depends on the workflow and git history the project is striving for. Up to now I have simply created new up to date branches for each change I want to make, so I never really had to deal with this. I will have to find out what the best solution is for that situation. Forks really are a different game than branches, but I am happy that I learned branches first. Otherwise working on multiple branches across forks would be even more confusing than it is now!