git synchronisation of a forked repository

Let us assume you have forked a repository (from You now have a local version at a given time of the repository repository_name.

git pull
cd repository_name

Time flyes and you come back to the local repository and you are not synchronised anymore. So, you need to fetch the new commits from the upstream repo, pull and push into your repository. this is done as follows:

git remote add upstream
git fetch upstream
git pull
git merge upstream/master
git push
Please follow and like us:
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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