I understand that the -u argument in git push
associates a local branch with its corresponding remote branch so that git pull
and git push
can be used without additional arguments.
However, as this answer (https://stackoverflow.com/a/16018004/8278160) states:
git push -u origin master
Is the same as:
git push origin master; git branch --set-upstream master origin/master
As Casey Li states in this video (https://www.youtube.com/watch?v=XogN0Q4sb9o), the format origin/repo
is used to designate a remote tracking branch.
As such, does git branch --set-upstream master origin/master
in the line above associate the local branch, master
, with its corresponding remote tracking branch (origin/master), or to the remote branch directly?
associate the local branch, master, with its corresponding remote tracking branch (origin/master), or to the remote branch directly?
In a local repo, there is no remote branches, only remote tracking branches, which are local branches tracing (ie keeping a copy of the last known state of) remote branches fetched in the repo.
See more at "Having a hard time understanding git-fetch".