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

Re: Making git disappear when talking about my code (was: Re: GIT vs Other: Need argument)

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Apr 25, 2007, 19:44 UTC
Message-ID
<Pine.LNX.4.64.0704251345220.28708@iabervon.org>
In-Reply-To
<87mz0w7g3j.wl%cworth@cworth.org>
On Wed, 25 Apr 2007, Carl Worth wrote:
Show 22 quoted lines
> On Mon, 23 Apr 2007 22:15:04 -0700, Junio C Hamano wrote:
> > Linus Torvalds <torvalds@linux-foundation.org> writes:
> >
> > > I'd personally be ok with a
> > >
> > > 	git clone --default=<branch> <url>
> ...
> > If Carl is also happy with the syntax, we can conclude this
> > discussion and:
> >
> >  (1) have that as an enhancement to git-clone;
> 
> I think it's a useful enhancement. It would let me at least document
> something like "tracking this project's stable branch" with a single
> command, which I think is useful. But I don't know that I would be
> totally happy yet. :-)
> 
> So please allow me to comment on the syntax a bit. Linus, you claimed
> that <url>#<branch> isn't "unixy" enough for your taste. What does
> that mean exactly? Is it that two logically independent things are
> crammed into a single argument instead of being passed as second
> arguments? Or something else?

Linus has stated a preference on the lkml for being told about branches in the syntax used for anonymous pulls: URL branchname.

That is, you say:
  Please pull from:
    git://server/path branch
And he cuts and pastes into the command line:
  git pull git://server/path branch

Now, this syntax isn't available for git-clone, because git-clone puts the optional directory to create after the URL. But, in an ideal world, this is how it would work; you could see a pull request, and just type "git some-command <paste>".

Show 10 quoted lines
> Here's the reason I want both the URL and the branch to appear as a
> single string, (but I don't really care about the precise syntax). I
> really want to be able to say "see my branch at <string>" and have
> that <string> be a complete and self-contained description of the
> branch that can be used in several different ways including:
> 
> * Cloning a new repository to track that branch as the default
> 
> * Begin tracking that branch as a new branch within an existing
>   repository

Here, you probably need to specify what you want the new branch to be, because it will often be the case that the remote branch will be "master" in a repository with a long unrecognizable URL, and you need to be able to switch to and away from the branch in some sane way. On the other hand, the user will presumably never care too deeply about the remote, aside from that git remembers stuff appropriately. I say, use the hash of the URL as the name of the remote, and provide some shorthand for the tracking branch that would be merged by default into the current head, and you're set. I.e.:

git track new-name URL [branch]
creates and checks out a new branch "new-name" with the config:
[remote "hash of URL"]
	url = URL
	fetch = +refs/heads/*:refs/remotes/hash of URL/*
[branch "new-name"]
	remote = "hash of URL"
	merge = refs/heads/[branch]

When on this branch, you update with "git pull" (which already works, given this configuration). And there would just need to be a better way of doing "git log remotes/hash of URL/branch..HEAD", which should probably be something like "git log MERGE..HEAD", with MERGE being magic for the thing that tracks the current branch's "merge" setting.

Incidentally, I'm not seeing the case of wanting to track multiple branches from the same repository as nearly as likely for a novice as wanting to track multiple branches from different repositories. I think the likely order of being interested in things is:

1. The project's maintainer's repository, exactly one of maint, master, or 
   next.
2. Somebody else's repository for some interesting feature, master
3. Somebody else's repository for all interesting features, some branch
4. Repository from 3, additional branches
5. Maintainer's repository, multiple branches.

With the most common case for two tracking branches being master from two repositories, such that upstream branch names are most often useless for distinguishing anything.

	-Daniel
*This .sig left intentionally blank*
Previous: Linus TorvaldsNext: Junio C Hamano
Message 64 of 120 in “GIT vs Other: Need argument”
  1. Pietro MascagniApr 17, 2007
  2. Matthieu MoyApr 17, 2007
  3. Andy ParkinsApr 17, 2007
  4. Alex RiesenApr 17, 2007
  5. Martin LanghoffApr 17, 2007
  6. Linus TorvaldsApr 17, 2007
  7. Matthieu MoyApr 17, 2007
  8. Martin LanghoffApr 17, 2007
  9. Alex RiesenApr 17, 2007
  10. Dana HowApr 25, 2007
  11. Alex RiesenApr 25, 2007
  12. Tomash BrechkoApr 17, 2007
  13. Guilhem BonnefilleApr 17, 2007
  14. Andy ParkinsApr 17, 2007
  15. Shawn O. PearceApr 17, 2007
  16. Marcin KasperskiApr 17, 2007
  17. Johannes SchindelinApr 18, 2007
  18. Linus TorvaldsApr 18, 2007
  19. Nicolas PitreApr 18, 2007
  20. Bill LearApr 18, 2007
  21. Matthieu MoyApr 18, 2007
  22. Nicolas PitreApr 18, 2007
  23. Matthieu MoyApr 19, 2007
  24. Petr BaudisApr 19, 2007
  25. Matthieu MoyApr 20, 2007
  26. Theodore TsoApr 18, 2007
  27. Guilhem BonnefilleApr 18, 2007
  28. Linus TorvaldsApr 18, 2007
  29. Daniel BarkalowApr 18, 2007
  30. Michael K. EdwardsApr 18, 2007
  31. Johannes SchindelinApr 19, 2007
  32. Matthieu MoyApr 19, 2007
  33. Johannes SchindelinApr 19, 2007
  34. Alex RiesenApr 19, 2007
  35. Christian MICHONApr 19, 2007
  36. Johannes SchindelinApr 19, 2007
  37. Christian MICHONApr 19, 2007
  38. Linus TorvaldsApr 19, 2007
  39. Marcin KasperskiApr 19, 2007
  40. Linus TorvaldsApr 19, 2007
  41. Carl WorthApr 23, 2007
  42. Josef WeidendorferApr 23, 2007
  43. Carl WorthApr 23, 2007
  44. Junio C HamanoApr 23, 2007
  45. Carl WorthApr 23, 2007
  46. Linus TorvaldsApr 23, 2007
  47. Brian GernhardtApr 23, 2007
  48. Daniel BarkalowApr 24, 2007
  49. Junio C HamanoApr 24, 2007
  50. J. Bruce FieldsApr 24, 2007
  51. Linus TorvaldsApr 24, 2007
  52. J. Bruce FieldsApr 30, 2007
  53. Making git disappear when talking about my code (was: Re: GIT vs Other: Need argument)Carl Worth, Apr 25, 2007
  54. Carl WorthApr 25, 2007
  55. Linus TorvaldsApr 25, 2007
  56. Carl WorthApr 25, 2007
  57. Nicolas PitreApr 25, 2007
  58. Carl WorthApr 25, 2007
  59. Junio C HamanoApr 25, 2007
  60. Nicolas PitreApr 25, 2007
  61. Carl WorthApr 25, 2007
  62. Nicolas PitreApr 25, 2007
  63. Linus TorvaldsApr 25, 2007
  64. Daniel BarkalowApr 25, 2007
  65. Junio C HamanoApr 25, 2007
  66. Linus TorvaldsApr 25, 2007
  67. Nicolas PitreApr 25, 2007
  68. Daniel BarkalowApr 25, 2007
  69. Carl WorthApr 25, 2007
  70. Daniel BarkalowApr 25, 2007
  71. Nicolas PitreApr 25, 2007
  72. Junio C HamanoApr 23, 2007
  73. Johannes SchindelinApr 19, 2007
  74. History cleanup/rewriting script for gitJan Harkes, Apr 20, 2007
  75. Johannes SchindelinApr 20, 2007
  76. Petr BaudisApr 20, 2007
  77. Jan HarkesApr 20, 2007
  78. Marcin KasperskiApr 19, 2007
  79. Johannes SchindelinApr 19, 2007
  80. Marcin KasperskiApr 19, 2007
  81. Johannes SchindelinApr 19, 2007
  82. J. Bruce FieldsApr 19, 2007
  83. Theodore TsoApr 19, 2007
  84. [ANNOUNCE] Cogito is for salePetr Baudis, Apr 19, 2007
  85. Matthieu MoyApr 19, 2007
  86. Junio C HamanoApr 19, 2007
  87. Johannes SchindelinApr 19, 2007
  88. Guilhem BonnefilleApr 18, 2007
  89. Andy ParkinsApr 18, 2007
  90. Steven GrimmApr 18, 2007
  91. Jakub NarebskiApr 19, 2007
  92. Steven GrimmApr 19, 2007
  93. Jakub NarebskiApr 19, 2007
  94. Johannes SchindelinApr 19, 2007
  95. Julian PhillipsApr 19, 2007
  96. Steven GrimmApr 19, 2007
  97. Johannes SchindelinApr 19, 2007
  98. Junio C HamanoApr 19, 2007
  99. Junio C HamanoApr 19, 2007
  100. Steven GrimmApr 19, 2007
  101. Junio C HamanoApr 19, 2007
  102. Shawn O. PearceApr 20, 2007
  103. Jakub NarebskiApr 20, 2007
  104. Karl HasselströmApr 20, 2007
  105. Junio C HamanoApr 20, 2007
  106. Petr BaudisApr 20, 2007
  107. Junio C HamanoApr 20, 2007
  108. Steven GrimmApr 20, 2007
  109. Yann DirsonApr 18, 2007
  110. Sam VilainApr 18, 2007
  111. Yann DirsonApr 18, 2007
  112. Dana HowApr 25, 2007
  113. Marcin KasperskiApr 19, 2007
  114. Alex RiesenApr 19, 2007
  115. Andy ParkinsApr 19, 2007
  116. Shawn O. PearceApr 20, 2007
  117. Eric BlakeApr 20, 2007
  118. Johannes SchindelinApr 19, 2007
  119. Marcin KasperskiApr 19, 2007
  120. Johannes SchindelinApr 19, 2007

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.