Add git fetch command to pull changes from the fork before setting local repo to track origin/master#15
Open
bytrangle wants to merge 1 commit intonnja:masterfrom
Open
Add git fetch command to pull changes from the fork before setting local repo to track origin/master#15bytrangle wants to merge 1 commit intonnja:masterfrom
git fetch command to pull changes from the fork before setting local repo to track origin/master#15bytrangle wants to merge 1 commit intonnja:masterfrom
Conversation
If not running this command before `git branch --set-upstream-to origin/master`, the origin/master branch doesn't exist yet in the remote repository. Hence, Git will throw an error: "The requested upstream branch 'origin/develop' does not exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
masterbranch to track the personal copyorigin/masterat 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
masteron 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/masterbranch at this point.If I run either of these two commands:
git fetch origin, orgit push -u origin master, then rungit branch -aagain, 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 fetchcommand beforegit branch --set-upstream-toso that other learns who follow it won't be caught off guard.