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

Re: [RFC PATCH] push: start warning upcoming default change for push.default

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Mar 9, 2012, 18:30 UTC
Message-ID
<4F5A4C45.7070406@xiplink.com>
In-Reply-To
<1331288715.21444.38.camel@beez.lab.cmartin.tk>
On 12-03-09 05:25 AM, Carlos Martín Nieto wrote:
Show 45 quoted lines
> On Fri, 2012-03-09 at 09:31 +0100, Matthieu Moy wrote:
>> More inexperienced users will often push right after committing, and at
>> that time they're still very much in the "working-on-one-branch" state of
>> mind.  "upstream" would be a safer default mode of operation for 'git push'
>> for them even when they have their personal publishing repository (also in
>> a shared public repository settings, "matching" is rarely the right
>> default mode).
>>
>> In preparation for flipping the default to the "upstream" mode from the
>> "matching" mode that is the upstream default, start warning users when they
>> rely on unconfigured "git push" to default to the "matching" mode.
>>
>> Original patch and commit message by: Junio C Hamano<gitster@pobox.com>
>>
>> Signed-off-by: Matthieu Moy<Matthieu.Moy@imag.fr>
>> ---
>>
>> This patch prepares a transition to 'upstream', unlike the previous
>> version which was advertizing 'current'. In most case, this would be
>> the same, but 'upstream' is probably more sensible in case it points
>> to a branch other than 'current'. I don't care much either way.
>>
>
> For people using git as VCS that happens to have local history rather
> than taking full advantage of the distributed nature (or who aren't
> aware of it or don't get it), 'matching' is bound to be confusing.
> However, IMO 'current' makes more sense. Consider
>
>      git clone ../foo; cd foo;
>      git checkout -b topic origin/develop
>      ed main.c
>      git push
>
> With upstream I've just updated origin's dev branch, even though I might
> have meant to create a new 'topic' branch. Alternatively, I might have
> run
>
>      git checkout -b topic
>
> in which case I certainly want 'current'. I don't see that workflow
> where the upstream branch is named differently from the local one should
> be that big a consideration when trying to determine a default to help
> people unfamiliar as they'd be certainly more likely to consider branch
> names to be binding. Maybe you have seen this differently in your
> students, but that's the impression I get from #git.
I disagree and consider "upstream" to be the more reasonable default.
I think that an incantation like
	git checkout -b topic origin/master

makes it pretty clear that topic is meant to be merged into origin's master branch. And so a simple "git push" as you describe I think *should* update origin's master branch.

OTOH, with a default of "current" I believe the simple "git push" will create a new branch named topic in the origin repo. To me that's implying too much from the simple "git push" command. If the user really wants a branch named topic in the origin repo, I think it's reasonable for git's default behaviour to require the user to say so explicitly ("git push origin topic").

I also disagree that an incantation like
	git checkout -b topic

means that the user wants "current" when they "git push". There's no indication here that the user is at all interested in remote branches with this topic, and I think it would be presumptuous for git to make such a link by default. (Besides, what if the user has more than one remote? Which should be used?)

In this case the "upstream" default would mean that git couldn't 
identify a remote for the topic branch and so the "git push" would fail. 
  I think that's appropriate, because the user never told git how the 
topic branch relates to any remote branches.
		M.
Previous: Carlos Martín NietoNext: Stefan Haller
Message 35 of 116 in “git push default behaviour?”
  1. Jeremy MortonMar 8, 2012
  2. Thomas RastMar 8, 2012
  3. Jeremy MortonMar 8, 2012
  4. Carlos Martín NietoMar 8, 2012
  5. Jeremy MortonMar 8, 2012
  6. Carlos Martín NietoMar 8, 2012
  7. Jeremy MortonMar 8, 2012
  8. Junio C HamanoMar 8, 2012
  9. Matthieu MoyMar 8, 2012
  10. Andreas KreyMar 8, 2012
  11. Junio C HamanoMar 8, 2012
  12. Matthieu MoyMar 9, 2012
  13. Junio C HamanoMar 9, 2012
  14. Jeremy MortonMar 9, 2012
  15. Matthieu MoyMar 9, 2012
  16. Jakub NarebskiMar 9, 2012
  17. Miles BaderMar 19, 2012
  18. Philippe VaucherMar 19, 2012
  19. Marc BranchaudMar 8, 2012
  20. Matthieu MoyMar 8, 2012
  21. Dmitry PotapovMar 8, 2012
  22. Matthieu MoyMar 8, 2012
  23. Jeff KingMar 9, 2012
  24. Junio C HamanoMar 9, 2012
  25. Junio C HamanoMar 9, 2012
  26. demerphqMar 9, 2012
  27. Thomas RastMar 9, 2012
  28. Junio C HamanoMar 9, 2012
  29. Gelonida NMar 16, 2012
  30. Matthieu MoyMar 9, 2012
  31. push: start warning upcoming default change for push.defaultMatthieu Moy, Mar 9, 2012
  32. Junio C HamanoMar 9, 2012
  33. Junio C HamanoMar 9, 2012
  34. Carlos Martín NietoMar 9, 2012
  35. Marc BranchaudMar 9, 2012
  36. Stefan HallerMar 9, 2012
  37. Junio C HamanoMar 10, 2012
  38. Stefan HallerMar 11, 2012
  39. Matthieu MoyMar 12, 2012
  40. Stefan HallerMar 12, 2012
  41. Matthieu MoyMar 12, 2012
  42. Junio C HamanoMar 12, 2012
  43. Marc BranchaudMar 12, 2012
  44. Michael HaggertyMar 10, 2012
  45. Marc BranchaudMar 12, 2012
  46. Matthieu MoyMar 12, 2012
  47. Junio C HamanoMar 12, 2012
  48. Jeff KingMar 12, 2012
  49. Junio C HamanoMar 12, 2012
  50. Junio C HamanoMar 12, 2012
  51. Marc BranchaudMar 12, 2012
  52. Matthieu MoyMar 13, 2012
  53. Matthieu MoyMar 13, 2012
  54. Jeff KingMar 13, 2012
  55. Junio C HamanoMar 13, 2012
  56. Jeff KingMar 14, 2012
  57. Junio C HamanoMar 14, 2012
  58. Matthieu MoyMar 13, 2012
  59. Junio C HamanoMar 13, 2012
  60. Matthieu MoyMar 13, 2012
  61. Stefan HallerMar 13, 2012
  62. Matthieu MoyMar 14, 2012
  63. Marc BranchaudMar 13, 2012
  64. Holger HellmuthMar 13, 2012
  65. Junio C HamanoMar 13, 2012
  66. Holger HellmuthMar 14, 2012
  67. Matthieu MoyMar 15, 2012
  68. Holger HellmuthMar 15, 2012
  69. Andreas EricssonMar 13, 2012
  70. Jeff KingMar 13, 2012
  71. Dmitry PotapovMar 13, 2012
  72. Junio C HamanoMar 14, 2012
  73. Dmitry PotapovMar 14, 2012
  74. Junio C HamanoMar 14, 2012
  75. Dmitry PotapovMar 14, 2012
  76. Junio C HamanoMar 14, 2012
  77. Matthieu MoyMar 14, 2012
  78. Dmitry PotapovMar 14, 2012
  79. Matthieu MoyMar 14, 2012
  80. Dmitry PotapovMar 14, 2012
  81. Matthieu MoyMar 15, 2012
  82. Michael HaggertyMar 14, 2012
  83. Jeff KingMar 14, 2012
  84. Ævar Arnfjörð BjarmasonMar 9, 2012
  85. Clemens BuchacherMar 16, 2012
  86. Matthieu MoyMar 16, 2012
  87. Junio C HamanoMar 16, 2012
  88. Matthieu MoyMar 16, 2012
  89. Clemens BuchacherMar 16, 2012
  90. Matthieu MoyMar 17, 2012
  91. Andrew MyersMar 19, 2012
  92. Junio C HamanoMar 9, 2012
  93. Matthieu MoyMar 9, 2012
  94. Junio C HamanoMar 9, 2012
  95. Junio C HamanoMar 9, 2012
  96. Jakub NarebskiMar 9, 2012
  97. Junio C HamanoMar 9, 2012
  98. Jakub NarebskiMar 13, 2012
  99. Matthieu MoyMar 12, 2012
  100. Junio C HamanoMar 12, 2012
  101. Matthieu MoyMar 13, 2012
  102. Junio C HamanoMar 13, 2012
  103. Junio C HamanoMar 16, 2012
  104. Eric HanchrowMar 17, 2012
  105. Dmitry PotapovMar 8, 2012
  106. Jakub NarebskiMar 8, 2012
  107. Jeremy MortonMar 8, 2012
  108. Jakub NarebskiMar 13, 2012
  109. Jeremy MortonMar 14, 2012
  110. Jakub NarebskiMar 14, 2012
  111. Matthieu MoyMar 8, 2012
  112. demerphqMar 8, 2012
  113. Sebastien DoucheMar 17, 2012
  114. Jeremy MortonMar 17, 2012
  115. Sebastien DoucheMar 17, 2012
  116. Pavel PospíšilMar 18, 2012

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.