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

Re: best git practices, was Re: Git User's Survey 2007 unfinished summary continued

From
Steffen Prohaska <prohaska@zib.de>
Date
Oct 24, 2007, 18:48 UTC
Message-ID
<90325C2E-9AF4-40FB-9EFB-70B6D0174409@zib.de>
In-Reply-To
<Pine.LNX.4.64.0710231155321.25221@racer.site>
On Oct 23, 2007, at 12:58 PM, Johannes Schindelin wrote:
Show 27 quoted lines
> On Tue, 23 Oct 2007, Steffen Prohaska wrote:
>
>>
>> On Oct 23, 2007, at 1:35 AM, Jakub Narebski wrote:
>>
>>> 2. Git can do a merge with conflicts _only_ if that branch is  
>>> checked
>>> out.
>>
>> Andreas' proposal contains an important requirement that avoids this
>> problem. His proposal states "when they, prior to fetching,  
>> pointed to
>> the same commit [the head in remotes pointed to]". That is only
>> fast-forwards are needed, which never have merge conflicts.
>
> You know what I do not like with this proposal?  The whole _point_  
> of this
> discussion is to make git _easier_.  Go ahead, try to explain to a
> complete git newbie the proposed behaviour.  I have a pound here which
> says that there is _no_ _way_ that this newbie says "well, that's  
> easy".
>
> Some people may not get this, but git has a reputation of being
> complicated, and my "BS" argument was, is, and will be, that we should
> keep clear and simple semantics, because they are the _only_ way to  
> battle
> that reputation.

I try to explain the workflow that I'd use the feature for. Maybe an easier setup could be used to achieve the same. Any suggestions for a simpler setup are welcome.

The workflow is used by a group of developers that all have access to a shared repository. One major goal is to keep the setup for most developers simple. They are new to git and as few commands as possible should be sufficient to start working. Besides the typical stable branches (master, next) shared topic branches should be available that can be used to develop and review features before they are merged to the stable branches. Patches are not send by email.

So here's the setup:
The central shared repo is called project-shared.git and contains,
for example, the following branches:
    master
    next
    work/topicA
    work/topicB
    ...

Developers clone the repo and check out the branches they are interested in. For example a developer may want to track next and work on topicB:

    git clone ssh://central.example.com/project-shared.git project
    cd project
    git checkout -b next origin/next
    git checkout -b work/topicB origin/work/topicB

This is sufficient. No adding of remotes is needed. Neither is a private repository on a server required. After cloning, developers have all they need.

Later work/topicB has new commits and should be pushed:
    git push origin

The default behaviour of push is fine. Only matching branches are pushed.

_But_, origin is a shared repository. Therefore branches may have advanced and git push may report

error: remote 'refs/heads/next' is not a strict subset of local ref 'refs/heads/next'. maybe you are not up-to-date and need to pull first?

So here's the problem. The developer didn't do anything wrong. But git complaints with an error. Git also recommends to run pull, so the developer runs "git pull". But this doesn't help, because it's only updating work/topicB and "git push" will complain with the very same error.

What you need to do is
    git checkout <local-branch>
    git pull
    git checkout <local-branch2>
    git pull
    ...
for every local branch.

This is absolutely stupid. Therefore the developer starts to hate git, or she just starts to ignore the errors because they don't have a real meaning most of the times. And later, when the error could be helpful she would ignore it, too.

The problem described can only happen with a shared repository. In a workflow that pulls from read-only repos and pushes to a private repo that is read-only for others, such a problem cannot happen. Because in a non-shared repository the branches cannot be advanced by others. But in a shared repository they can.

I see two reasonable solutions:
1) "git push" only pushes the current branch.
2) "git pull" pulls all branches as proposed by Andreas.

Maybe something that I don't see is fundamentally wrong with the setup.

Johannes, you mentioned that it is essential to distinguish remote branches from local branches. In general, I agree. The problem described above is 'smaller' if you have less local branches that you're not actively working on. But I believe it is reasonable to have more than one of them. The remotes track everything and your local branches are a subset of things you're interested in although you're not working on each of the branch every day. I don't think it's reasonable to delete a local branch immediately each time you stopped working on it.

I think root of the problem is that git is more focused on pulling from read-only and pushing to non-shared repos. The support for shared repos needs to be improved before it is perfect.

	Steffen
Previous: Johannes SchindelinNext: J. Bruce Fields
Message 68 of 161 in “Re: Git User's Survey 2007 unfinished summary continued”
  1. Jakub NarebskiOct 8, 2007
  2. Git User's Survey 2007 unfinished summary continuedJakub Narebski, Oct 12, 2007
  3. Frank LichtenheldOct 12, 2007
  4. Johannes SchindelinOct 13, 2007
  5. J. Bruce FieldsOct 13, 2007
  6. Shawn O. PearceOct 13, 2007
  7. Frank LichtenheldOct 13, 2007
  8. Johannes SchindelinOct 13, 2007
  9. Andreas EricssonOct 13, 2007
  10. David KastrupOct 13, 2007
  11. J. Bruce FieldsOct 13, 2007
  12. David KastrupOct 13, 2007
  13. Johannes SchindelinOct 14, 2007
  14. Linus TorvaldsOct 14, 2007
  15. Shawn O. PearceOct 14, 2007
  16. Linus TorvaldsOct 14, 2007
  17. david@lang.hmOct 14, 2007
  18. Linus TorvaldsOct 14, 2007
  19. Reece DunnOct 14, 2007
  20. Steven GrimmOct 14, 2007
  21. J. Bruce FieldsOct 14, 2007
  22. Steven GrimmOct 14, 2007
  23. Andreas EricssonOct 14, 2007
  24. Johannes SchindelinOct 14, 2007
  25. Andreas EricssonOct 14, 2007
  26. J. Bruce FieldsOct 14, 2007
  27. Nicolas PitreOct 14, 2007
  28. Shawn O. PearceOct 15, 2007
  29. Nicolas PitreOct 16, 2007
  30. Johannes SchindelinOct 16, 2007
  31. Johannes SchindelinOct 14, 2007
  32. Andreas EricssonOct 14, 2007
  33. David KastrupOct 14, 2007
  34. Jakub NarebskiOct 14, 2007
  35. Johannes SchindelinOct 14, 2007
  36. David KastrupOct 14, 2007
  37. David KastrupOct 14, 2007
  38. Jakub NarebskiOct 14, 2007
  39. Matthew AndrewsOct 14, 2007
  40. David KastrupOct 14, 2007
  41. David TweedOct 14, 2007
  42. Federico Mena QuinteroOct 19, 2007
  43. Jakub NarebskiOct 19, 2007
  44. Johannes SchindelinOct 19, 2007
  45. Federico Mena QuinteroOct 22, 2007
  46. Andreas EricssonOct 20, 2007
  47. Steffen ProhaskaOct 20, 2007
  48. Andreas EricssonOct 20, 2007
  49. Dmitry PotapovOct 21, 2007
  50. Jakub NarebskiOct 20, 2007
  51. Johannes SchindelinOct 20, 2007
  52. Andreas EricssonOct 21, 2007
  53. Johannes SchindelinOct 21, 2007
  54. Andreas EricssonOct 22, 2007
  55. best git practices, was Re: Git User's Survey 2007 unfinished summary continuedJohannes Schindelin, Oct 22, 2007
  56. Andreas EricssonOct 22, 2007
  57. Johannes SchindelinOct 22, 2007
  58. Andreas EricssonOct 22, 2007
  59. Johannes SchindelinOct 22, 2007
  60. Andreas EricssonOct 22, 2007
  61. Steffen ProhaskaOct 22, 2007
  62. Federico Mena QuinteroOct 22, 2007
  63. Johannes SchindelinOct 22, 2007
  64. Carl WorthOct 25, 2007
  65. Jakub NarebskiOct 22, 2007
  66. Steffen ProhaskaOct 23, 2007
  67. Johannes SchindelinOct 23, 2007
  68. Steffen ProhaskaOct 24, 2007
  69. J. Bruce FieldsOct 24, 2007
  70. Andreas EricssonOct 24, 2007
  71. J. Bruce FieldsOct 24, 2007
  72. Steffen ProhaskaOct 24, 2007
  73. J. Bruce FieldsOct 24, 2007
  74. Andreas EricssonOct 24, 2007
  75. J. Bruce FieldsOct 24, 2007
  76. Peter BaumannOct 24, 2007
  77. Steffen ProhaskaOct 24, 2007
  78. Johannes SchindelinOct 24, 2007
  79. Steffen ProhaskaOct 24, 2007
  80. J. Bruce FieldsOct 24, 2007
  81. Steffen ProhaskaOct 24, 2007
  82. Johannes SchindelinOct 24, 2007
  83. Steffen ProhaskaOct 25, 2007
  84. Johannes SchindelinOct 25, 2007
  85. Steffen ProhaskaOct 25, 2007
  86. Andreas EricssonOct 25, 2007
  87. Peter BaumannOct 25, 2007
  88. Andreas EricssonOct 25, 2007
  89. Steffen ProhaskaOct 25, 2007
  90. Johannes SchindelinOct 25, 2007
  91. Andreas EricssonOct 25, 2007
  92. Steffen ProhaskaOct 25, 2007
  93. Johannes SchindelinOct 25, 2007
  94. Theodore TsoOct 25, 2007
  95. Andreas EricssonOct 25, 2007
  96. Theodore TsoOct 25, 2007
  97. Andreas EricssonOct 25, 2007
  98. Junio C HamanoOct 25, 2007
  99. Andreas EricssonOct 25, 2007
  100. Steffen ProhaskaOct 26, 2007
  101. Andreas EricssonOct 26, 2007
  102. Federico Mena QuinteroOct 25, 2007
  103. Mike HommeyOct 25, 2007
  104. J. Bruce FieldsOct 25, 2007
  105. Theodore TsoOct 25, 2007
  106. Andreas EricssonOct 25, 2007
  107. David KastrupOct 26, 2007
  108. Federico Mena QuinteroOct 25, 2007
  109. J. Bruce FieldsOct 25, 2007
  110. Federico Mena QuinteroOct 25, 2007
  111. J. Bruce FieldsOct 25, 2007
  112. Andreas EricssonOct 25, 2007
  113. J. Bruce FieldsOct 25, 2007
  114. David KastrupOct 26, 2007
  115. Make rebase smarterSteven Walter, Oct 26, 2007
  116. Andreas EricssonOct 26, 2007
  117. Johannes SchindelinOct 26, 2007
  118. Junio C HamanoOct 26, 2007
  119. Johannes SchindelinOct 26, 2007
  120. Junio C HamanoOct 26, 2007
  121. Andreas EricssonOct 24, 2007
  122. Johannes SchindelinOct 24, 2007
  123. Andreas EricssonOct 25, 2007
  124. Johannes SchindelinOct 25, 2007
  125. Andreas EricssonOct 25, 2007
  126. Johannes SchindelinOct 25, 2007
  127. Andreas EricssonOct 25, 2007
  128. Karl HasselströmOct 25, 2007
  129. Andreas EricssonOct 25, 2007
  130. Peter BaumannOct 25, 2007
  131. Steffen ProhaskaOct 24, 2007
  132. Andreas EricssonOct 24, 2007
  133. Jakub NarebskiOct 24, 2007
  134. Andreas EricssonOct 25, 2007
  135. Johannes SchindelinOct 25, 2007
  136. Steffen ProhaskaOct 25, 2007
  137. Federico Mena QuinteroOct 25, 2007
  138. Andreas EricssonOct 23, 2007
  139. Daniel BarkalowOct 22, 2007
  140. Wincent ColaiutaOct 22, 2007
  141. David SymondsOct 22, 2007
  142. Johannes SchindelinOct 22, 2007
  143. Robin RosenbergOct 22, 2007
  144. Alex RiesenOct 23, 2007
  145. Nguyen Thai Ngoc DuyOct 22, 2007
  146. Federico Mena QuinteroOct 22, 2007
  147. Jakub NarebskiOct 24, 2007
  148. Karl HasselströmOct 24, 2007
  149. Jakub NarebskiOct 24, 2007
  150. Karl HasselströmOct 24, 2007
  151. Jakub NarebskiOct 24, 2007
  152. Karl HasselströmOct 25, 2007
  153. Catalin MarinasOct 24, 2007
  154. Jakub NarebskiOct 22, 2007
  155. Johannes SchindelinOct 22, 2007
  156. Andreas EricssonOct 22, 2007
  157. Federico Mena QuinteroOct 22, 2007
  158. Jakub NarebskiOct 22, 2007
  159. Steven GrimmOct 22, 2007
  160. J. Bruce FieldsOct 21, 2007
  161. Shawn O. PearceOct 13, 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.