Git: How to Sync Fork Repo With Master Repo

In this post, I will give you a step-by-step on How to synchronize your forked repository with the master repository.

First thing first, go to your forked repository and make sure to you in master branch

git checkout master

Setting Up the Master Remote Repository

git remote add upstream [URL]

Fetch Remote Repository Master

git fetch upstream

Now, you have downloaded the master repository, but not yet merge with your fork repository.

To merge your fork repository with master repository, run the following command:

git merge upstream/master

Now you have merge your local fork repository with master repository.

Next, you just have to push your fork repository to your fork remote repository.

git push fork master

Now you are done synchronize your fork repository with master repository! Congratulations!


Leave a Reply

Your email address will not be published. Required fields are marked *

12 + fifteen =