Add git fetch
command to pull changes from the fork before setting local repo to track origin/master
#15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I attempted to set up my local
master
branch to track the personal copyorigin/master
at my fork with the command:I got an error “The requested upstream branch 'origin/master' does not exist”.
I believe the reason is that we haven't made a local copy of the branch named
master
on the remote namedorigin
.To see all the branches associated with the repo, run
git branch -a
. The output is as followed:Git is not aware of any
origin/master
branch at this point.If I run either of these two commands:
git fetch origin
, orgit push -u origin master
, then rungit branch -a
again, the output is the same as above, but including an extra line:remotes/origin/master
.Then run
git branch --set-upstream-to origin/master
, then it works as expected with the message: “Branch 'master' set up to track remote branch 'master' from 'origin'.”Hence, I propose that in the Solution section for exercise 8, we add the
git fetch
command beforegit branch --set-upstream-to
so that other learns who follow it won't be caught off guard.