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

Re: pull.prompt or other way to slow/disable 'git pull'

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 3, 2014, 09:50 UTC
Message-ID
<5364bbfc8c0a0_ac68dd308ce@nysa.notmuch>
In-Reply-To
<20140503000530.GP28634@odin.tremily.us>
W. Trevor King wrote:
Show 19 quoted lines
> On Fri, May 02, 2014 at 05:20:11PM -0500, Felipe Contreras wrote:
> > W. Trevor King wrote:
> > > > > The 'git pull' (with 'none' mode) explainer just helps retrain folks
> > > > > that are already using the current 'git pull' incorrectly.
> > > > 
> > > > If you are going to train them to use a configuration, it should be:
> > > > 
> > > > % git config --global pull.ff false
> > > 
> > > I don't want all pulls to be --no-ff, only pulls from topic branches.
> > 
> > Pulling some branch to a topic branch, or pulling a topic branch to
> > another branch?
> 
> The latter.  Here's a more detailed list:
> 
> 1. HEAD: an integration branch (master, maint, …)
>    target: @{upstream}, branch.*.pushremote, and other mirrors
>    my preferred integration mode: ff-only merge the target
`git pull` would do that by default.
> 2. HEAD: an integration branch
>    target: a *different* branch (e.g. maint or feature-x, but not
>      origin/master or jdoe/master, if HEAD is master)
>    my preferred integration mode: no-ff merge the target into HEAD.
That makes sense, but other people would be OK with a ff merge.
> 3. HEAD: a topic branch (e.g. feature-x)
>    target: a collaborating topic branch (jdoe/feature-x)
>    my preferred integration mode: ff-only merge the target

I don't see why. It will alomst always be non-fast-fowrward, so you should already be prepared for a merge (or rebase).

> 4. HEAD: a topic branch (e.g. feature-x)
>    target: a related topic branch (e.g. jdoe/feature-y) or integration
>      branch updates used by my feature-x
>    my preferred integration mode: rebase feature-x onto the target

Nah. Most people would prefer a merge. And actually, quite many would want jdoe/feature-y to be rebased on top of feature-x.

Either way it would be impossible for Git to figre out what you want to do.

Show 5 quoted lines
> Cases 1 and 2 can usually be distinguished by comparing the
> checked-out branch with the branch portion of the remote-tracking
> reference), but for folks developing in master, jdoe/master may be a
> feature branch (case 2) not a mirror of the maintenance branch (case
> 1).
I'd say they can be distinguished by what the user typed.
 
> Cases 1 and 3 are the same idea, with any feature branch running long
> enough to get collaborators being indistinguishable from an
> integration branch except that the latter will eventually be merged
> (or dropped) and deleted.
Ineed, so why would you want so drastically different behavior?
 
Show 42 quoted lines
> In the event of non-trivial merge conflicts in case 2, I sometimes
> rebase the target onto HEAD and no-ff merge the resulting target'.  On
> the other hand, sometimes rebasing is not an option.  For example, if
> I want to merge the target into both master and maint, but master
> contains a conflicting commit A:
> 
>   -o---o---A---o---B  master
>    |\
>    | o---o---C  maint
>     \
>      o---D  target
> 
> Rebasing would drag A into maint at F:
> 
>   -o---o---A---o---B---E  master
>     \       \         /
>      \       o---D'---  target'
>       \           \
>        o---o---C---F  maint
> 
> And I don't want both the pre- and post-rebase versions in my history
> at G:
> 
>   -o---o---A---o---B---E---G  master
>    |\       \         /   /
>    | \       o---D'---   /  target'
>    |  \                 /
>    |   o---o---C---F----  maint
>     \             /
>      o---D--------  target
> 
> So I'd just deal with a complicated merge at E:
> 
>   -o---o---A---o---B---E---G  master
>    |\                 /   /
>    | o---D------------   /  target
>     \           \       /
>      o---o---C---F------  maint
> 
> Case 4 has similar caveats, since you don't want to rebase feature-x
> on top of jdoe/feature-y if there are already other branches based on
> the current feature-x that can't (or won't) be rebased.

What I do in those cases is do both a merge and a rebase. If I resolved the conflicts correctly in the rebase the result of the merge should be exactly the same. It's not hard because rerere stores the conflict resolutions of the rebase and the merge becomes much simpler. After I'm certain the merge is correct, I remove the temporary rebased branch.

Anyway I don't see how is this possibly relevant to the topic at hand.
Show 9 quoted lines
> > Either way, since I think these two are different modes:
> > 
> >   1) git pull
> >   2) git pull origin topic
> > 
> > Maybe it would actually make sense to have a configuration specific to
> > 2): pull.topicmode.
> 
> I think it makes more sense to just use merge/rebase explicitly,

Fine, if you want the user to be explicit, he can be explicit with `git pull --no-ff origin topic`. Problem solved.

-- 
Felipe Contreras
Previous: W. Trevor KingNext: W. Trevor King
Message 39 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.