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

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

From
FQFederico Mena Quintero <federico@novell.com>
Date
Oct 25, 2007, 16:06 UTC
Message-ID
<1193328386.4522.352.camel@cacharro.xalalinux.org>
In-Reply-To
<Pine.LNX.4.64.0710242258201.25221@racer.site>
On Wed, 2007-10-24 at 23:14 +0100, Johannes Schindelin wrote:
> Whenever I told people "pull = fetch + merge", they got it.
[snip]
> My "pupils" _always_ liked the preciseness of the nomenclature.  And they 
> made many less mistakes because they had a clear mental model of what is 
> remote, and what is local.  And that local branches are always forks.

This is a *very* powerful concept. Unfortunately, it is not 100% clear in the documentation, at least not when you are reading about fetch/merge/pull initially.

After reading the user's manual, I just could not understand what "fetch" does, and therefore "merge" and "pull" did not make sense. I could not understand where Git stored the new changes from upstream while also keeping my working directory in the same state it was. After 10 years of using CVS/SVN, the assumption you have is, "whenever I get changes from the remote repository, they will be visible in my working copy (and merge conflicts are a fact of life)".

Some time later, I ran into "Git for computer scientists" and then finally I got it, thanks to the nice diagrams and explanation. I realized how powerful a concept "fetch" is: THIS is the right way to examine what upstream worked on while you did your own local work.

Once you understand what's going on, however, it is not obvious how to *visualize* the state of things after you do "git fetch". Probably "gitk --all" is the correct way to do it, but the presentation is not ideal --- you have to hunt down the list of commits until you find your own "master" (or whatever branch), and *there* is where you can say, "oh, this is where we diverged; now let's see what I'll get when I rebase later".

So, a few problems so far, with possible solutions:
* The docs do not make it easy to understand what git-fetch does.  Can
we just cut&paste most of "Git for computer scientists" into the Git
user's manual?).
* It's not obvious how to visualize the state after git-fetch, i.e.
"gitk --all" is not the first thing that occurs to you.  Maybe git-fetch
should suggest you to run "gitk --all" when your remotes get changes, so
that you can see what's going on?
* It's hard to find the "divergence point" in gitk's display, since you
have to scroll down the reverse-chronological list of commits until you
find your local refs and where they started diverging.  Would there be a
way to "flatten" the display a bit, so your local stuff is always easy
to find, and yet it's easy to see what the remote changes were?
> And here I have to disagree strongly.  In a workflow based on a
> shared 
> repository, you do not want to merge.  You want to rebase.

.. And after I understood what "fetch" does, "rebase" became obvious, and *this* is where I started loving Git. I understood that in the past all I had been doing with CVS was to rebase by hand; that is where I said "Git is such a powerful tool".

> But _even if_ you merge instead of rebase, I fail to see how the current 
> situation is different from CVS (which many people maintain is _easier_ 
> than gi), where first thing you do is to "cvs update".  Just for git it is 
> "git pull".

It's a matter of perception. CVS requires *less* steps, even if you do more manual work. To commit something, you need to

  cvs update
  <resolve conflicts by hand - they are a fact of life, remember?>
  cvs commit
Whereas with Git you need
  git fetch
  git rebase <huh, what was the name of the remote branch?>
  <fix conflicts>
  git commit
  git push
[Maybe that's not 100% the right sequence, but you know what I mean.]

So your perception is that you have to fiddle more with Git (look up the remote branch name, invoke more git commands), even if Git saved you a lot of work when rebasing.

When you start using a complex tool like CVS or Git, you do it by voodoo: you learn sequences of commands, but you don't really understand what they do. If one tool makes you use less comands, it is perceived as simpler and more powerful ("because the other one needs more babysitting").

So, Git needs to make it very clear from the beginning (in the user's manual or the distilled tutorials) that it has *very powerful* concepts at your disposal. It needs to *teach you* how it will save you a lot of work when compared to traditional tools like CVS.

  Federico
Previous: David KastrupNext: J. Bruce Fields
Message 108 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.