Re: git fetch documentation problem or bug
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 8, 2012, 19:18 UTC
- Message-ID
- <7vbogclqm6.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <7vfw5olqp9.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 28 quoted lines
> Angelo Borsotti <angelo.borsotti@gmail.com> writes: > >> git fetch <repository> <refspec> does not create the remote refs in >> the current (local) >> repository... >> However, if a git fetch origin is executed, the refs are properly created: > > Working as designed and documented. > > $ git fetch origin master > > is giving the refspec "master" from the command line which is a > short-hand for "refs/heads/master". > > When you run > > $ git fetch origin > > configured refspec is looked up from your config (because you didn't > give any from the command line). The default refspec in your config > is likely to be "refs/heads/*:refs/remotes/origin/*". > > The former, "refs/heads/master" refspec, tells Git not to update the > remote tracking branch. The latter has colon and right-hand-side of > the colon tells Git what to update with what was fetched. > > It would hlep to read up on refspec by running "git fetch --help" > and looking for a string "colon".
Addendum. Your claim
>> git fetch <repository> <refspec> does not create the remote refs in >> the current (local) >> repository...
is incorrect. The behaviour depends on what <refspec> you give.
In other words, you can do this from the command line if you want to do the update.
$ git fetch origin master:refs/remotes/origin/master