That allows you to:
- update your local version of the master upstream branch only (as opposed as updating all branches of the upstream repo, which can be longer to do)
- no trigger a merge right away (as opposed to the pull command)
The git merge
will then try to merge that local version of the upstream master to your repo master branch.
So here, master is, for the fetch
command, a refspec.
<refspec>
The format of a <refspec>
parameter is an optional plus +, followed by the source ref <src>
, followed by a colon :, followed by the destination ref <dst>
.
The remote ref that matches <src>
is fetched, and if <dst>
is not empty string, the local ref that matches it is fast-forwarded using <src>
.
If the optional plus +
is used, the local ref is updated even if it does not result in a fast-forward update.
Here, <dst>
is empty, so the matching local branch (your master) is updated.
Without master, that would give:
git fetch upstream
The above command copies all branches from the remote refs/heads/
namespace and stores them to the local refs/remotes/upstream/
namespace, unless the branch.<name>.fetch
option is used to specify a non-default refspec.