Update a fork of a repository to keep it up-to-date with the upstream repository.
- Add the remote (original repo you forked) and call it
upstream
:
$ git remote add upstream https://github.com/User/original-repo.git
or use SSH
$ git remote add upstream git@github.com:User/original-repo.git
- Fetch all branches of remote
upstream
:
$ git fetch upstream
- Rewrite your master with
upstream
’smaster
using git rebase:
$ git rebase upstream/master
- Push your updates to
master
.
$ git push origin master
You may need to force
the push with:
$ git push origin master --force
All done!
Top comments (0)