To avoid confusion,
recent versions of
gitdeprecate this somewhat ambiguous
in favor of a more verbose
with identical syntax and behavior.
[ Reference ]
git branch --set-upstream-to <remote-branch>
sets the default remote branch for the current local branch.
git pull command (with the current local branch checked-out),
will attempt to bring in commits from the
<remote-branch> into the current local branch.
One way to avoid having to explicitly type
--set-upstream-to is to use its shorthand flag
-u as follows:
git push -u origin local-branch
This sets the upstream association for any future push/pull attempts automatically.
For more details, checkout this detailed explanation about upstream branches and tracking.