If you have forked a Git repository, you’ll need to sync it with the upstream repo so that your changes are applied to the current version of the project.
Check current remotes:
This will probably output
origin, denoting that your repo has a single remote.
Configure a Git remote for the upstream (original) repo:
git remote add upstream https://github.com/original-project/original-project.git
git remote # Output: origin upstream
Sync Local Fork with Upstream
There are now three repositories:
- origin (GitHub, Bitbucket etc)
- upstream (The original repo)
Sync from upstream to local, then push changes to origin:
# fetch changes git fetch upstream # switch to master branch git checkout master # Merge changes from upstream into master git merge upstream/master # Push local changes to origin git push
comments powered by Disqus