git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Clarify that '--tags' fetches tags only

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 22, 2011, 00:49 UTC
Message-ID
<7vwrd1z9it.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAMOZ1BuSd52woX0utOQ84gbCzBkZg3ATKnE+7G_BrD5_hUQSiQ@mail.gmail.com>
Michael Witten <mfwitten@gmail.com> writes:
Show 6 quoted lines
> On Wed, Sep 21, 2011 at 23:52, Anatol Pomozov <anatol.pomozov@gmail.com> wrote:
>> +       linkgit:git-config[1]. Note that if this option is specified
>> +       then only tags are fetched, refs under refs/heads/* stay unchanged.
>
> Note that if this option is specified, then only tags
> are fetched; refs under refs/heads/* are not changed.
Can we improve the wording without singling out refs/heads/* specifically?
I think the updated wording is not desirable for two reasons.

For one thing, for the most newbies, I think refs/remotes/origin/* (not refs/heads/*) would be the hierarchy that they may expect to get updated and surprised.

When you give --tags (or any other refspec for that matter; --tags is merely a short-hand for "refs/tags/*:refs/tags/*") explicitly from the command line, you are overriding the refspecs configured for the remote, and all the refs that are _not_ covered by the refspec you gave from the command line will stay unchanged, not just refs/heads/* but refs under other hierarchies (like refs/remotes/* and refs/notes/*).

Once the reader understands that the command line _overrides_ the configured fetch refspecs, everything else should fall naturally into place without further explanation. For example,

	$ git pull origin frotz

would internally invoke "git fetch origin another_branch", and it would not update any refs for the _same exact reason_ [*1*]. You are giving a refspec from the command line (in this case, "grab refs/heads/frotz, but do not store it anywhere"), and it overrides the usual fetch refspec that may update "+refs/heads/*:refs/remotes/origin/*" (grab all refs at the origin under refs/heads/ hierarchy, and store in refs/remotes/origin).

[Footnote]

*1* The merging of the result would update the current branch but that is a natural consequence of "a pull integrates by running either a merge or a rebase after running a fetch".

Previous: Michael WittenNext: Michael Witten
Message 5 of 32 in “Clarify that '--tags' fetches tags only”
  1. Clarify that '--tags' fetches tags onlyAnatol Pomozov, Sep 2, 2011
  2. Drew NorthupSep 2, 2011
  3. Clarify that '--tags' fetches tags onlyAnatol Pomozov, Sep 21, 2011
  4. Michael WittenSep 22, 2011
  5. Junio C HamanoSep 22, 2011
  6. Michael WittenSep 22, 2011
  7. Michael WittenSep 22, 2011
  8. Andrew ArdillSep 22, 2011
  9. Michael WittenSep 22, 2011
  10. Docs: Clarify the --tags option of `git fetch'Michael Witten, Sep 22, 2011
  11. Michael WittenSep 22, 2011
  12. Junio C HamanoSep 22, 2011
  13. Docs: Clarify the --tags option of `git fetch'Michael Witten, Sep 22, 2011
  14. Junio C HamanoSep 22, 2011
  15. Michael WittenSep 22, 2011
  16. Michael WittenSep 22, 2011
  17. Junio C HamanoSep 22, 2011
  18. Docs: Clarify the --tags option of `git fetch'Michael Witten, Sep 22, 2011
  19. Daniel JohnsonSep 22, 2011
  20. Peter ShenkinSep 30, 2011
  21. Jakub NarebskiSep 30, 2011
  22. Michael WittenSep 30, 2011
  23. Peter ShenkinOct 1, 2011
  24. Michael WittenOct 1, 2011
  25. Peter ShenkinOct 1, 2011
  26. Michael WittenOct 1, 2011
  27. Peter ShenkinOct 1, 2011
  28. Michael WittenOct 1, 2011
  29. Peter ShenkinOct 1, 2011
  30. Peter ShenkinOct 1, 2011
  31. Junio C HamanoSep 30, 2011
  32. Peter ShenkinOct 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.