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

Re: Considering teaching plumbing to users harmful

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 16, 2008, 20:12 UTC
Message-ID
<7vr69tpoze.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<32541b130807161246l579d3a5em65496ee9119ef1ef@mail.gmail.com>
"Avery Pennarun" <apenwarr@gmail.com> writes:
Show 13 quoted lines
> On 7/16/08, Junio C Hamano <gitster@pobox.com> wrote:
>>  You said svn makes it easier because it makes it very hard to do merges
>>  and forces users to stay away from them.  This results in user doing "svn
>>  update" which is to resolve conflicts with large uncommitted changes but
>>  keeps the history straight single-strand-of-pearls.
>>
>>  I am not saying the merge based workflow in git does not have any room to
>>  improve.  I am just saying that there is nothing we can learn from svn in
>>  that area.  "Solves it by not letting us to do merges" is not a solution.
>
> What svn does is essentially an unsafe version of
>
>        git stash && git pull x y && git stash apply

If you are advocating that mode of operation to be easy in git, you should think again. That pull (be it with or without --rebase) can conflict and you would need to resolve it, and then your "stash pop" can conflict again. You can have your own "git avery-up" alias which is your "svn up" equivalent, but if you train users with that first, the users have to learn how to cope with conflicts in individual steps anyway.

Making these three into a single alias is not an improvement either. If you are not ready to incorporate other's changes to your history, why are you pulling? Being distributed gives the power of working independently and at your own pace. You should train your brain to think about the workflow first. "You should stash before pull" is _not_ a good advice. "Do not pull when you are not ready" is.

Suppose you are about to finish something you have been cooking (say a series of five logical commits), you've made three of these commits already, and what you have in your work tree and the index is to be split into the last two commits. Somehow you learn that $x above has a updated version.

Yes, running "git stash && git pull --rebase && git stash pop" would be better than running "git pull --rebase" alone from that state. But that would mean your history would have your first 3 commits (of 5 commit series), somebody else's totally unrelated commits, and then you will work on finishing the remaining 2 commits on top of it. Why? Why is such a bogus linear history any better?

With git, instead, you have the choice:
	* "git fetch" first to see if it is truly urgent; otherwise you
          don't even have to pull.  First finish whatever you were doing
          and then make the pull
	    $ make commit 1
            $ make commit 2
            $ git pull
	  This results in a merge but it is a good merge.  The resulting
	  history shows your 5 commits are isolated work independently
	  developed while that urgent thing was being done elsewhere.
	* if it is, then, you save away your work and pull first:
	    $ git branch mywork
            $ git stash save "remaining two commits' worth of changes"
            $ git reset --hard HEAD~3 # wipe your 3 commits
            $ git pull
	  and then continue working:
	    $ git checkout mywork
            $ git stash pop
            $ make commit 1
            $ make commit 2
	  and finally integrate:
            $ git checkout master
            $ git merge mywork
	  or if you really want linear, pretend all 5 of your commits
	  were done on top of that urgent thing.
            $ git rebase master
            $ git checkout master
            $ git merge mywork
> And that's actually a good example of what I'm talking about; in svn,
> that's just "svn up",...

What you forgot to add in the above is that in svn the equivalent of "pull x y" step will always fast forward because you will not be making forked development with the upstream. In svn it's just "svn up" and it results in a linear history because that command does not work with merges. By definition, not working with merges will result in linear history.

Previous: Avery PennarunNext: Theodore Tso
Message 42 of 114 in “Considering teaching plumbing to users harmful”
  1. Johannes SchindelinJul 16, 2008
  2. Jesper EskilsonJul 16, 2008
  3. Johannes SchindelinJul 16, 2008
  4. Jesper EskilsonJul 16, 2008
  5. Johannes SchindelinJul 16, 2008
  6. Avery PennarunJul 16, 2008
  7. Johannes SchindelinJul 16, 2008
  8. Avery PennarunJul 16, 2008
  9. Theodore TsoJul 16, 2008
  10. Daniel BarkalowJul 16, 2008
  11. David KastrupJul 17, 2008
  12. Jakub NarebskiJul 17, 2008
  13. David KastrupJul 17, 2008
  14. Subversion's do-everything-via-copying paradigm ( was RE: Re: Considering teaching plumbing to users harmful)Craig L. Ching, Jul 17, 2008
  15. David KastrupJul 17, 2008
  16. Craig L. ChingJul 17, 2008
  17. Avery PennarunJul 17, 2008
  18. Junio C HamanoJul 17, 2008
  19. Jakub NarebskiJul 17, 2008
  20. Kevin BallardJul 17, 2008
  21. Petr BaudisJul 17, 2008
  22. Kevin BallardJul 17, 2008
  23. Jakub NarebskiJul 17, 2008
  24. Kevin BallardJul 17, 2008
  25. Jakub NarebskiJul 17, 2008
  26. Kevin BallardJul 17, 2008
  27. Kevin BallardJul 17, 2008
  28. David KastrupJul 17, 2008
  29. Robin RosenbergJul 17, 2008
  30. Dmitry PotapovJul 18, 2008
  31. Subversion is actually not so simple (was RE: Considering teaching plumbing to users harmful)Craig L. Ching, Jul 17, 2008
  32. Jakub NarebskiJul 17, 2008
  33. Daniel BarkalowJul 17, 2008
  34. Junio C HamanoJul 16, 2008
  35. Avery PennarunJul 16, 2008
  36. Petr BaudisJul 16, 2008
  37. Avery PennarunJul 16, 2008
  38. Junio C HamanoJul 16, 2008
  39. Avery PennarunJul 16, 2008
  40. Junio C HamanoJul 16, 2008
  41. Avery PennarunJul 16, 2008
  42. Junio C HamanoJul 16, 2008
  43. Theodore TsoJul 16, 2008
  44. Junio C HamanoJul 16, 2008
  45. Sean KelleyJul 16, 2008
  46. Nigel MagnayJul 16, 2008
  47. Stephen SinclairJul 17, 2008
  48. Ping YinJul 18, 2008
  49. Dmitry PotapovJul 16, 2008
  50. Johannes SchindelinJul 16, 2008
  51. Theodore TsoJul 16, 2008
  52. Johannes SchindelinJul 17, 2008
  53. Theodore TsoJul 17, 2008
  54. Craig L. ChingJul 17, 2008
  55. Petr BaudisJul 17, 2008
  56. J. Bruce FieldsJul 17, 2008
  57. david@lang.hmJul 16, 2008
  58. Dmitry PotapovJul 16, 2008
  59. Stephen R. van den BergJul 16, 2008
  60. Nicolas PitreJul 16, 2008
  61. Junio C HamanoJul 16, 2008
  62. Johannes SchindelinJul 16, 2008
  63. Junio C HamanoJul 16, 2008
  64. Johannes SchindelinJul 17, 2008
  65. Junio C HamanoJul 17, 2008
  66. J. Bruce FieldsJul 17, 2008
  67. Karl HasselströmJul 17, 2008
  68. Johannes SchindelinJul 17, 2008
  69. Junio C HamanoJul 17, 2008
  70. Johannes SchindelinJul 17, 2008
  71. Junio C HamanoJul 17, 2008
  72. J. Bruce FieldsJul 18, 2008
  73. Addremove equivalent [was: Re: Considering teaching plumbing to users harmful]Michael J Gruber, Jul 18, 2008
  74. Jay SoffianJul 18, 2008
  75. Johannes SchindelinJul 18, 2008
  76. Junio C HamanoJul 20, 2008
  77. 1/2 builtin-add.c: restructure the code for maintainabilityJunio C Hamano, Jul 20, 2008
  78. 2/2 git-add -a: add all filesJunio C Hamano, Jul 20, 2008
  79. 3/2 git-add -a: testsJunio C Hamano, Jul 20, 2008
  80. TarmiganJul 20, 2008
  81. TarmiganJul 20, 2008
  82. Johannes SchindelinJul 20, 2008
  83. Jay SoffianJul 20, 2008
  84. Junio C HamanoJul 20, 2008
  85. Lars NoschinskiJul 20, 2008
  86. Jeff KingJul 20, 2008
  87. Junio C HamanoJul 21, 2008
  88. Jeff KingJul 21, 2008
  89. Jeff KingJul 21, 2008
  90. Jay SoffianJul 21, 2008
  91. Sverre RabbelierJul 20, 2008
  92. Dmitry PotapovJul 16, 2008
  93. Johannes SchindelinJul 16, 2008
  94. Stephan BeyerJul 16, 2008
  95. Johannes SchindelinJul 16, 2008
  96. Stephan BeyerJul 17, 2008
  97. Peter Valdemar Mørch (Lists)Jul 17, 2008
  98. Dmitry PotapovJul 17, 2008
  99. Theodore TsoJul 17, 2008
  100. Peter Valdemar MørchJul 17, 2008
  101. Theodore TsoJul 17, 2008
  102. Junio C HamanoJul 17, 2008
  103. Andreas EricssonJul 18, 2008
  104. Jeff KingJul 18, 2008
  105. Suggestion: doc restructuring [was: Re: Considering teaching plumbing to users harmful]Michael J Gruber, Jul 18, 2008
  106. Jon LoeligerJul 18, 2008
  107. Craig L. ChingJul 18, 2008
  108. Junio C HamanoJul 18, 2008
  109. Johannes SchindelinJul 19, 2008
  110. Junio C HamanoJul 20, 2008
  111. Johannes SchindelinJul 20, 2008
  112. Andreas EricssonJul 21, 2008
  113. Johannes SchindelinJul 21, 2008
  114. Junio C HamanoJul 21, 2008

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.