Need to sync your forked branch with the original master branch. Read on to learn how to do this.

Let's say you forked a repo 2 weeks back and you made some changes and even a pull request. Now, you're getting back into your forked branch and your forked branch is not synced with the original repo master branch.

Simple enough, you can do the following:

$ git fetch upstream

Wu Oh! Did you get an error? Something like:

fatal: 'upstream' does not appear to be a git repository

No worries! That means that you need to tell your repo where to fetch this remote upstream. You can do this with the following:

$ git remote add upstream

make sure to add the original github repo URL for your project

Now, you can confirm that you have the upstream repo specified by running:

$ git remote -v
origin (fetch)
origin (push)
upstream (fetch)
upstream (push)

You should only need to add the upstream once from here on out you will be able to sync your forked branch by doing the following:

$ git fetch upstream

Make sure to checkout master branch

$ git checkout master

And lastly merge the remote upstream (or the original repo)

git merge upstream/master

And BOOM! your forked repo is now synced with the latest master branch ;)


or Sign Up

Sign Up

or Login