Instructor Notes
This is a placeholder file. Please add content here.
Introduction
Branches
Remote Repositories
Create and Modify Connections
The git remote command also lets you manage connections
with other repositories. The following commands will modify the repo’s
./.git/config file. The result of the following commands
can also be achieved by directly editing the ./.git/config
file with a text editor.
Create a new connection to a remote repository. After adding a
remote, you’ll be able to use <name> as a convenient
shortcut for <url> in other Git commands.
Remove the connection:
Rename a connection:
To get high-level information about the remote
<name>:
Exercise: Add a connection to your neighbour’s repository. Having this kind of access to individual developers’ repositories makes it possible to collaborate outside of the central repository. This can be very useful for small teams working on a large project.
Starting a branch from the main repository state:
Remember that when you create a new branch without specifying a starting point, then the starting point will be the current state and branch. In order to avoid confusion, ALWAYS branch from the stable version. Here is how you would branch from your own origin/main branch:
You must fetch first so that you have the most recent state of the repository.
If there is another “true” version/state of the project, then this
connection may be set as upstream (or something else).
Upstream is a common name for the stable repository, then
the sequence will be:
Now we can set the MPIA version of our repository as the upstream for our local copy.
Setting the upstream repository
Set the https://github.com/mpi-astronomy/advanced-git-training as the upstream locally.
Then, examine the state of your repository with
git branch, git remote -v,
git remote show upstream
BASH
git remote add upstream https://github.com/mpi-astronomy/advanced-git-training.git
git fetch upstream
git checkout -b develop upstream/develop