git synchronisation of a forked repository

Let us assume you have forked a repository (from https://github.com/project/repository_name). You now have a local version at a given time of the repository repository_name.

git pull https://github.com/project/repository_name
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 https://github.com/project/repository_name.git
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.