When you collaborate in an open source project it is likely to be asked to make a fork of one repository. A fork is a copy of the project in your GitHub account. This duplicate allows you to freely experiment with changes without affecting the original project.

There is a problem when you fork a project, it is not going to have the last changes made in the original one, so in order to avoid problems when you try to push your changes it is better to keep your fork up to date.

Here’s how.

Synchronizing Your Forked Project

Once you have forked the repository, clone it in your local machine. Go to the directory of the project and list the current configured remote repository for your fork.

Specify a new remote upstream repository that will be synced with the fork.

Verify the new upstream repository you’ve specified for your fork.

Fetch the branches and their respective commits from the upstream repository.

Check out your fork’s local master branch.

Merge the changes from upstream/master into your local master branch.

The latest changes done in the original repository are now in your local project. Keep in mind that to update your fork on GitHub, you must push your changes.


Don’t forget It’s important to keep your fork up to date in order to avoid merge conflicts or losing your work completely when you try to push your changes. So if you are starting to collaborate in an open source project and you would like to know more information about forks and upstreams click here