-
Notifications
You must be signed in to change notification settings - Fork 286
Syncing a fork
How to sync a fork of a repository to keep it up-to-date with the upstream repository is explained here. We recap hereafter the instructions.
To [sync changes you make in a fork](# Syncing a fork of ViSP) with the original repository, you must first configure a remote that points to the upstream repository in Git.
-
Open Terminal (for Mac and Linux users) or the command prompt (for Windows users).
-
List the current configured remote repository for your fork.
$ git remote -v origin https://github.com/YOUR_USERNAME/visp.git (fetch) origin https://github.com/YOUR_USERNAME/visp.git (push)
-
Specify a new remote upstream repository that will be synced with the fork.
$ git remote add upstream https://github.com/lagadic/visp.git
-
Verify the new upstream repository you've specified for your fork.
$ git remote -v origin https://github.com/YOUR_USERNAME/visp.git (fetch) origin https://github.com/YOUR_USERNAME/visp.git (push) upstream https://github.com/lagadic/visp.git (fetch) upstream https://github.com/lagadic/visp.git (push)
-
Open Terminal (for Mac and Linux users) or the command prompt (for Windows users).
-
Change the current working directory to your local project.
-
Fetch the branches and their respective commits from the upstream repository. Commits to
master
will be stored in a local branch,upstream/master
.$ git fetch upstream remote: Counting objects: 57, done. remote: Compressing objects: 100% (47/47), done. remote: Total 57 (delta 22), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (57/57), done. From https://github.com/lagadic/visp * [new branch] master -> upstream/master
-
Check out your fork's local
master
branch.$ git checkout master
-
Merge the changes from
upstream/master
into your localmaster
branch. This brings your fork'smaster
branch into sync with the upstream repository, without losing your local changes.$ git merge upstream/master Updating 67afb0d..fc31b59 Fast-forward modules/core/include/visp3/core/vpHistogram.h | 52 ++++++++++--- modules/core/include/visp3/core/vpImage.h | 48 ++++++++++++ modules/core/include/visp3/core/vpMath.h | 144 +++++++++++++++++++++++++++++++++++- modules/core/src/tools/histogram/vpHistogram.cpp | 81 ++++++++++++++++++-- modules/core/test/math/testMath.cpp | 288 +++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 591 insertions(+), 22 deletions(-)
-
To update your fork on GitHub, you must push your changes.
$ git push