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

Re: [howto] Kernel hacker's guide to git, updated

From
Junio C Hamano <junkio@cox.net>
Date
Oct 1, 2005, 07:36 UTC
Message-ID
<7voe69664a.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0509301112100.3378@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> Hey, even more impressive is "git pull --all", which will happily try to 
> create an octopus of every single ref available at the other end.
True.

However, I think --all is a mistake even if you use it without merging in 'git fetch', so I am not planning to do refs/heads/ side, at least not yet. Even if you prevent an Octopus, what would you do then? If you choose to merge one of them, which one? Not merging any that is not explicitly specified on the command line, seems to me the most sensible and safe option.

The rule for 'pull' to decide which refs to merge is:
 (1) if command line has explicit refspecs (--tags and --heads
     do not count), they are all merged.
 (2) if command line has no explicit refspecs (--tags and
     --heads do not count), the default one found from either
     remotes or branches file is merged.

Notice that I am forbidding remotes file to say "by default I always merge these three heads from there to make an Octopus" by the above rule (branches file cannot even name more than one head so this is not an issue). Since everybody seems to agree that Octopus is not something that is done mechanically and routinely anyway [*1*], I think this is a sensible way to guard against accidental Octopus.

We could consider fetching all heads, by minimally renaming remote master to origin and getting everything else under the same name, but I'd really want to keep the local namespace for branches isolated from each other. Many kernel.org public repositories seem to have 'test' and 'release' branches and if you are a maintainer of such a tree, and if you are interested in another maintainer's tree, and if that other maintainer has the 'test' and 'release' branches, --heads (or --tags) overwriting your 'test' with his 'test' is obviously not what you want.

Possibly, something like this could be arranged later:
	* git fetch --heads=$ns $remote "$@"
	In addition to the usual refspecs (the rest of the
	command line arguments), fetch all remote heads and
	store remote refs/heads/$a under local refs/heads/$ns/$a
	for all $a.  If $ns is empty, remote "master" is renamed
	"origin".
	* git fetch --heads $remote "$@"
        shorthand for empty $ns
[Footnote]

*1* I do make many Octopus merges, but they happen across my local topic branches. Topics merged change day-by-day, and even the set of topics alive at the time changes everyday. IOW, it is not something I would want to do with the same sets of heads every time by describing them in the remotes file.

Previous: Linus TorvaldsNext: Oliver Neukum
Message 33 of 40 in “[howto] Kernel hacker's guide to git, updated”
  1. Jeff GarzikSep 29, 2005
  2. David LeimbachSep 29, 2005
  3. Alberto PatinoSep 29, 2005
  4. David LeimbachSep 29, 2005
  5. Oliver NeukumSep 29, 2005
  6. Jon LoeligerSep 29, 2005
  7. Oliver NeukumSep 29, 2005
  8. Junio C HamanoSep 30, 2005
  9. Oliver NeukumSep 30, 2005
  10. Linus TorvaldsSep 30, 2005
  11. Dave JonesSep 29, 2005
  12. Anton AltaparmakovSep 29, 2005
  13. Dave JonesSep 29, 2005
  14. Linus TorvaldsSep 29, 2005
  15. Linus TorvaldsSep 29, 2005
  16. Dave JonesSep 29, 2005
  17. Linus TorvaldsSep 29, 2005
  18. Anton AltaparmakovSep 29, 2005
  19. Linus TorvaldsSep 29, 2005
  20. Anton AltaparmakovSep 29, 2005
  21. Junio C HamanoSep 29, 2005
  22. Johannes SchindelinSep 30, 2005
  23. Elfyn McBratneySep 29, 2005
  24. Linus TorvaldsSep 29, 2005
  25. Dave JonesSep 29, 2005
  26. Jeff GarzikSep 29, 2005
  27. Junio C HamanoSep 29, 2005
  28. Jeff GarzikSep 30, 2005
  29. Junio C HamanoSep 30, 2005
  30. Jeff GarzikSep 30, 2005
  31. Junio C HamanoOct 2, 2005
  32. Linus TorvaldsSep 30, 2005
  33. Junio C HamanoOct 1, 2005
  34. Oliver NeukumSep 30, 2005
  35. Jeff GarzikSep 30, 2005
  36. Alberto PatinoSep 30, 2005
  37. Erik MouwSep 30, 2005
  38. Jeff GarzikSep 30, 2005
  39. Francois RomieuSep 30, 2005
  40. Chuck LeverSep 29, 2005

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.