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

Re: Pull is Evil

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 1, 2014, 19:16 UTC
Message-ID
<53629da233345_76612eb2f075@nysa.notmuch>
In-Reply-To
<7vbnvhil5x.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 29 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
> 
> > brian m. carlson wrote:
> >> ..
> >> At work, we have a workflow where we merge topic branches as
> >> non-fast-forward, so that we have a record of the history (including who
> >> reviewed the code), but when we want to just update our local branches,
> >> we always want fast-forward:
> >> 
> >>   git checkout maintenance-branch
> >>   # Update our maintenance branch to the latest from the main repo.
> >>   git pull --ff-only
> >>   git pull --no-ff developer-remote topic-branch
> >>   git push main-repo HEAD
> >> 
> >> So there are times when fast-forward merges are the right thing, and
> >> times when they're not, and as you can see, this depends on context and
> >> isn't per-repository.
> >
> > That's not what I asked.
> >
> > I didn't ask you if fast-forward merges were the right thing to do in
> > every situation.
> >
> > I asked you, *when* people do a fast-forward merge (that is; when it's
> > possible and desirable), what are the problems that a fast-forward merge
> > causes?
> 
> But then I think you asked a wrong question.

I asked the simple uncontroversial question as a rhetorical aid. I hoped I would get the obvious answer, but I didn't even get that, so what hope is there of convincing these people of the one that needs real pondering?

Show 10 quoted lines
> The opposite case of the question tells me what is wrong in it:
> 
>     When people do a real merge (that is: when it's possible and
>     desirable), there is no reason to forbid 'git pull' from creating a
>     real merge.  What are the problems that a real merge causes under
>     that condition?
> 
> By definition, because of "when it's possible and DESIRABLE" part,
> the answer is "absolutely zero".  That is not an interesting
> question, is it?

That's right, but we are discussing the default behavior of `git pull`, which if we agree has no problems when the ff is a) possible, and b) desirable, the problems must come when either one of those is not met.

 a) If the fast-forward is not possible, that creates problems, because
    a real merge might happen, and it's not desirable. However, if we
    don't allow real merges to happen by default this couldn't be a
    problem.
 b) If the fast-forward is not desirable, then the user wouldn't be
    running `git pull`, would be running `git pull --no-ff`.

In other words, after the proposed changes `git pull` by default would have no issues.

Show 5 quoted lines
> Doesn't Brian's case show the justification "because everybody will
> accept fast-forward" does not hold?  It shows that the user do not
> necessarily know when it's possible and DESIRABLE, and updating the
> command is about helping people avoid an action that may not be
> desirable in the end.

No, it doesn't hold. As I said, if we change the default the fact that it's not possible is not an issue.

The only problem would be when it's not desirable, however, that's a problem of the user's ignorance, and the failure of the project's policity to communicate clearly to him that he should be running `git merge --no-ff`. There's absolutely nothing we can do to help him.

The only thing we could do is not allow fast-forward merges either, in which case `git pull` becomes a no-op that can't possibly do anything ever.

> Brian needs a way to make sure he fast-forwards when pulling the
> project's maintenance-branch into his maintenance-branch, and also he
> does *not* fast-forward when pulling developer's fix branch into that
> same maintenance-branch of his.

First of all this use-case is not realistic. The moment he merges a developer branch, hes maintenance and the probject's diverge, and all the pulls after that cannot be fast-forward.

It's pointless to add something that just doesn't happen. It will be possible to do the fast-forward merges only early on the life of this branch, not afterwards. For this short period of time he can just simply use his fingers to type `git merge --no-ff`.

-- 
Felipe Contreras
Previous: Junio C HamanoNext: W. Trevor King
Message 19 of 73 in “A failing attempt to use Git in a centralized environment”
  1. Marat RadchenkoApr 28, 2014
  2. Junio C HamanoApr 28, 2014
  3. Pull is Evil (was: Re: A failing attempt to use Git in a centralized environment)Marc Branchaud, Apr 30, 2014
  4. Junio C HamanoApr 30, 2014
  5. Marc BranchaudApr 30, 2014
  6. Jonathan NiederApr 30, 2014
  7. Junio C HamanoApr 30, 2014
  8. Marc BranchaudApr 30, 2014
  9. Andreas KreyMay 2, 2014
  10. David KastrupMay 2, 2014
  11. Andreas KreyMay 3, 2014
  12. David KastrupMay 3, 2014
  13. Felipe ContrerasApr 30, 2014
  14. Marc BranchaudApr 30, 2014
  15. Felipe ContrerasApr 30, 2014
  16. brian m. carlsonMay 1, 2014
  17. Felipe ContrerasMay 1, 2014
  18. Junio C HamanoMay 1, 2014
  19. Felipe ContrerasMay 1, 2014
  20. W. Trevor KingMay 1, 2014
  21. W. Trevor KingMay 1, 2014
  22. Felipe ContrerasMay 1, 2014
  23. W. Trevor KingMay 2, 2014
  24. Felipe ContrerasMay 2, 2014
  25. W. Trevor KingMay 2, 2014
  26. Felipe ContrerasMay 2, 2014
  27. W. Trevor KingMay 2, 2014
  28. Felipe ContrerasMay 2, 2014
  29. W. Trevor KingMay 2, 2014
  30. David KastrupMay 2, 2014
  31. Felipe ContrerasMay 2, 2014
  32. W. Trevor KingMay 2, 2014
  33. Felipe ContrerasMay 2, 2014
  34. W. Trevor KingMay 2, 2014
  35. Felipe ContrerasMay 2, 2014
  36. pull.prompt or other way to slow/disable 'git pull' (was: Pull is Evil)W. Trevor King, May 2, 2014
  37. Felipe ContrerasMay 2, 2014
  38. W. Trevor KingMay 3, 2014
  39. Felipe ContrerasMay 3, 2014
  40. W. Trevor KingMay 4, 2014
  41. Felipe ContrerasMay 4, 2014
  42. Felipe ContrerasMay 1, 2014
  43. Marc BranchaudMay 1, 2014
  44. W. Trevor KingMay 1, 2014
  45. Marc BranchaudMay 1, 2014
  46. W. Trevor KingMay 1, 2014
  47. Marc BranchaudMay 1, 2014
  48. Felipe ContrerasMay 1, 2014
  49. Andreas KreyMay 2, 2014
  50. Felipe ContrerasMay 2, 2014
  51. Junio C HamanoMay 2, 2014
  52. Junio C HamanoMay 2, 2014
  53. brian m. carlsonMay 1, 2014
  54. Felipe ContrerasMay 1, 2014
  55. Felipe ContrerasMay 1, 2014
  56. Marc BranchaudMay 1, 2014
  57. Felipe ContrerasMay 1, 2014
  58. Philip OakleyMay 1, 2014
  59. Philip OakleyMay 1, 2014
  60. Felipe ContrerasMay 1, 2014
  61. W. Trevor KingMay 1, 2014
  62. Felipe ContrerasMay 2, 2014
  63. Felipe ContrerasApr 30, 2014
  64. Matthieu MoyApr 30, 2014
  65. Felipe ContrerasApr 30, 2014
  66. Junio C HamanoApr 30, 2014
  67. Felipe ContrerasApr 30, 2014
  68. Junio C HamanoApr 30, 2014
  69. Felipe ContrerasApr 30, 2014
  70. Stepan KasalApr 30, 2014
  71. Geert BoschApr 30, 2014
  72. John SzakmeisterMay 4, 2014
  73. Max KirillovMay 2, 2014

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.