Syncing Your GitHub Fork

.

If you have forked a project on GitHub, you will have your own copy of the project in your GitHub account. Your copy will not be automatically synced with the original. Follow these simple steps to sync your repo with the original repo:

Assuming you have your fork on your local computer (local clone of the fork is created using git clone command). Add the remote upstream:

# git remote add upstream $originalRepoURL

Check the remote URL: # git remote -v

You will see the URLs of the fork and the original.

Now fetch the upstream: # git fetch upstream

Check out the local master branch of the fork: # git checkout master

Doing this you will be switched to the local master branch of the fork.

Merge the changes. Assuming you want to merge the local master branch of the fork with the master branch of the upstream: # git merge upstream/master
Push the changes to your GitHub copy: # git push origin master

Enter your credentials and check the update on GitHub.


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s