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

Re: first parent, commit graph layout, and pull merge direction

From
John Keeping <john@keeping.me.uk>
Date
May 23, 2013, 16:41 UTC
Message-ID
<20130523164114.GV27005@serenity.lan>
In-Reply-To
<7vd2shheic.fsf@alter.siamese.dyndns.org>
On Thu, May 23, 2013 at 09:01:15AM -0700, Junio C Hamano wrote:
Show 27 quoted lines
> John Keeping <john@keeping.me.uk> writes:
> 
> > I've been annoyed by this at $DAYJOB recently.  A lot of people seem to
> > blindly "git pull" without much thought about how the history is ending
> > up and what they actually want to do.
> 
> I think these two are essentially the same thing, and having an
> option to flip the heads of a merge only solves a half of the
> problem.
> 
> A merge that shows everybody else's work merged into your history
> means you are the integrator, the keeper of the main history.  And
> the first-parent view of the history is useful only when the keeper
> of the main history takes good care of the main history.
> 
> When you are using a "central shared repository" workflow, if you
> had and used an option to flip the heads of a merge to record what
> you have done so far as a side branch of what everybody else did to
> do the merge, or if you rebased your work on top of what everybody
> else did, the first-parent view would make a bit more sense than
> what you currently get.  At least, everybody else's work will not
> appear as a side branch that does 47 unrelated things, and your work
> will appear as a side branch.  That is a big plus.
> 
> But the other half of the problem still remains, i.e. "what they
> actually want to do".  People tend to do too many "pull" when their
> work is not ready, only to "catch up", and that is the real problem.
...
Show 8 quoted lines
> One obvious way to solve it is to use a topic branch workflow (the
> first picture above; 'x's are built not on local 'master'), and you
> do a "git pull" from the shared repository while you are on your
> 'master', which is free of your 'x's until that 6-commit series is
> complete and ready.  Then you locally merge that topic branch and
> push it back for everybody to see, which will give you the first
> picture in this message.  Incidentally, this does not need the "flip
> the heads" option.

Yes, I don't think this is as much of a problem when using a topic branch workflow, because it's clear what the history should look like and users are expected to get it right.

Where I see this is when people are aiming for a linear history but don't get that because with "git pull" to catch up they end up with these backwards merges. In these cases, I think what users really want is "git pull --rebase".

I have to wonder how often "git pull" with no arguments actually does what users really want (even if they don't know it!) when it doesn't result in a fast-forward (and pull.rebase isn't configured).

Hence my suggestion to error when "git pull" doesn't result in a fast-forward and no branch name is specified. We could give some advice like:

    Your local changes are not included in the local branch and you
    haven't told Git how to preserve them.
    If you want to rebase your changes onto the modified upstream
    branch, run:
        git pull --rebase
Show 9 quoted lines
> Solving half a problem is better than solving no problem, and
> especially because not all changes need to be multi-commit series
> but can be done directly, perfectly and fully on the local 'master'
> (i.e. 2+3+1=6 split would not happen for such changes).  For these
> reasons, I personally am not strongly opposed to a "flip the heads"
> option, if implemented cleanly.
> 
> But people need to realize that it is not solving the other half, a
> more fundamental problem some people have in their workflow.

Yes, but some users don't realise that their workflow is broken, and perhaps we can nudge them in the right direction.

Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 69 in “first parent, commit graph layout, and pull merge direction”
  1. Andreas KreyMay 22, 2013
  2. Junio C HamanoMay 22, 2013
  3. Andreas KreyMay 23, 2013
  4. John SzakmeisterMay 23, 2013
  5. Jeremy RosenMay 23, 2013
  6. Andreas KreyMay 23, 2013
  7. John KeepingMay 23, 2013
  8. Junio C HamanoMay 23, 2013
  9. John KeepingMay 23, 2013
  10. Junio C HamanoMay 23, 2013
  11. John KeepingMay 23, 2013
  12. Felipe ContrerasMay 23, 2013
  13. Junio C HamanoMay 23, 2013
  14. Felipe ContrerasMay 23, 2013
  15. Junio C HamanoMay 23, 2013
  16. Felipe ContrerasMay 23, 2013
  17. Junio C HamanoMay 23, 2013
  18. Felipe ContrerasMay 23, 2013
  19. John KeepingMay 24, 2013
  20. John SzakmeisterMay 24, 2013
  21. Linus TorvaldsMay 24, 2013
  22. Junio C HamanoMay 24, 2013
  23. Linus TorvaldsMay 24, 2013
  24. Felipe ContrerasMay 24, 2013
  25. Felipe ContrerasMay 24, 2013
  26. Junio C HamanoMay 24, 2013
  27. Philip OakleyMay 24, 2013
  28. pull: require choice between rebase/merge on non-fast-forward pullJunio C Hamano, Jun 27, 2013
  29. W. Trevor KingJun 27, 2013
  30. Junio C HamanoJun 27, 2013
  31. W. Trevor KingJun 28, 2013
  32. Matthieu MoyJun 28, 2013
  33. W. Trevor KingJun 28, 2013
  34. Matthieu MoyJun 28, 2013
  35. W. Trevor KingJun 28, 2013
  36. Fredrik GustafssonJun 27, 2013
  37. Junio C HamanoJun 27, 2013
  38. W. Trevor KingJun 27, 2013
  39. Junio C HamanoJun 27, 2013
  40. Matthieu MoyJun 27, 2013
  41. W. Trevor KingJun 28, 2013
  42. John KeepingJun 28, 2013
  43. Junio C HamanoJun 28, 2013
  44. John KeepingJun 28, 2013
  45. Junio C HamanoJun 28, 2013
  46. John KeepingJul 2, 2013
  47. fixup! pull: require choice between rebase/merge on non-fast-forward pullJohn Keeping, Jul 14, 2013
  48. Junio C HamanoJul 15, 2013
  49. Felipe ContrerasAug 28, 2013
  50. John KeepingJul 18, 2013
  51. Andreas SchwabJul 18, 2013
  52. Junio C HamanoJul 18, 2013
  53. pull: require choice between rebase/merge on non-fast-forward pullJunio C Hamano, Jul 18, 2013
  54. Eric SunshineJul 19, 2013
  55. Junio C HamanoJul 19, 2013
  56. Eric SunshineJul 19, 2013
  57. Junio C HamanoJul 19, 2013
  58. Eric SunshineJul 19, 2013
  59. Junio C HamanoJul 19, 2013
  60. FlimmJan 22, 2014
  61. Andreas KreyMay 24, 2013
  62. Junio C HamanoMay 24, 2013
  63. Andreas KreyMay 23, 2013
  64. Holger Hellmuth (IKS)May 24, 2013
  65. Andreas KreyMay 24, 2013
  66. Holger Hellmuth (IKS)May 24, 2013
  67. Andreas KreyMay 24, 2013
  68. Felipe ContrerasMay 23, 2013
  69. Andreas KreyMay 23, 2013

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.