Once you’ve forked and cloned a repo the following describes how to sync the local fork with the upstream remote.
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