Before you will be able to pull changes from the upstream your local repository will need to know where to find the upstream repository. In earlier figures (e.g. FigureΒ 4.1.1), there were dotted orange lines indicating that your local repository knew about your origin and that your origin knew about the upstream. However, there was no orange dotted line from your local repository to the upstream. That is because, by default, your local repository does not know the location of the upstream repository.
In FigureΒ 4.2.1 a dotted orange line was added pointing from your local repository to the upstream. Git needs to have this information so that it can pull changes from the upstream into your local repository. In this section, you will see that the upstream remote provides this information.
Click here to open your development environment. Please be patient as this can take a few minutes. When the development environment is ready you will see the message "Kit development environment is ready for use." and your browser window will look similar to the following:
A Git remote is the URL of a remote and an associated name (e.g. origin, upstream). Git uses Git remotes to locate remote repositories. Though it can be confusing, the remote is also commonly used as a synonym for Git remote.
Examine the output of the git remote -v command. You should see two lines labeled origin (fetch and push), and two lines labeled upstream (also fetch and push).
The dotted orange arrow on the left that points from your local repository to the origin.
Correct!
The dotted orange arrow on the right that points from your local repository to the upstream.
The arrow on the right represents a Git remote associated with your local repository, but it is not the origin.
The dotted orange arrow at the top that points from your origin repository to the upstream.
The arrow at the top represents a Git remote associated with your origin repository, not your local repository.
The blue cylinder at the top left of the figure.
The blue cylinder at the top left represents the origin remote repository.
The blue cylinder at the top right of the figure.
The blue cylinder at the top right represents the upstream remote repository.
Hint.
Look at the diagram again. The origin Git remote will be associated with your local repository and will indicate where the origin repository is located.
As you saw in SubsectionΒ 4.3.2Β Understanding Remotes your local repository contains an upstream remote that points to the upstream being used for your course. This upstream was set automatically by the development environment when you opened your local repository.
Not all development environments are able to automatically set the upstream remote when you open your local repository. The exercises in this section will walk you through how you can manually set the upstream remote if you need to.
Give a command that will create a new Git remote named upstream that points to the GitKit FarmData2 upstream repository that you are using for this course.
Note that if you are using a development environment that does not automatically set the upstream remote for you, you will still only need to set it once. Once the upstream remote is set for a repository you will be able to pull from the upstream repo as often as is necessary.
It is also worth mention that there is nothing particularly special about the names of the remotes. The names origin and upstream are used by convention by most developers. However, you could name your remotes anything you like and they would still work.