Syncing a Fork

At work, we work with an agency who provides website development services. They own and maintain the repository on github and we only have read access to it. So in order for us to make changes, we have to fork the repository, make changes, and send pull requests.

However, because developers at the agency work on the site everyday, our forks are not always up-to-date with the original repository. Then when we need to make changes, we have to make sure that we have the latest changes in our forked projects before sending pull requests. So here is a set of commands you can run to make your forked repo up-to-date with the original repo.

First, fetch all branches and commits from the upstream (original) repository.

Check out your fork’s local master

Then merge the changes from upstream to your local master

At this point, you have all the latest changes from original repo on your local machine. Next we sync up the changes from your local machine to your fork.

That’s it!