-
Notifications
You must be signed in to change notification settings - Fork 146
Remotes
When working with other developers, it proves useful from time to time to checkout a copy of a remote collaborator's branch, say to view changes or test a new feature implemented on that branch. Say your collaborator Alice works on a common file system, has login name alice
and her EGSnrc repository is ~alice/EGSnrc
. To checkout a local copy of her newfeature
branch in your EGSnrc repository, follow these steps:
cd /path/to/your/EGSnrc/repository
git remote add alice ~alice/EGSnrc
git fetch alice
* [new branch] master -> alice/master
* [new branch] develop -> alice/develop
* [new branch] newfeature -> alice/newfeature
git chechout -b newfeature alice/newfeature
Branch newfeature set up to track remote branch newfeature from alice.
Switched to a new branch 'newfeature'
Note that any URL can be used instead of ~alice/EGSnrc
in this example (for example https://github.com/egsalice/EGSnrc
if she maintains a clone of EGSnrc under an egsalice
github account).
At this point you will be on a local branch newfeature
which tracks alice's remote newfeature
branch. When you are done you can remove this branch and the remote with:
git checkout master
git branch -D newfeature
git remote rm alice
For more information on remotes, see https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes.
- Overview
- Install on VirtualBox
- Install on Linux
- Install on macOS
- Install on Windows
- Quick installation
- Upgrading