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

Re: [PATCH] pull: conflict hint pull.rebase suggestion should offer "merges" vs "true"

From
Tao Klerks <tao@klerks.biz>
Date
Feb 21, 2023, 15:40 UTC
Message-ID
<CAPMMpohfF5Cwgxt_G+Gp4rNPGTJZcQfmgEoJcFi_Kzbv2XGuog@mail.gmail.com>
In-Reply-To
<CAMMLpeSZs8DqrN6_F9-eg7fcbjV-O5+3V+hUsOhyd0x10xsCaQ@mail.gmail.com>
On Mon, Feb 20, 2023 at 7:33 PM Alex Henrie <alexhenrie24@gmail.com> wrote:
Show 11 quoted lines
>
> Tao, the primary motivation behind the `git pull` warning was to help
> prevent users from merging main into a topic branch when that's not
> what they really want to do. The fact that novices sometimes do that
> has been a point of pain for many people, including Linus Torvalds:
> See "Don't merge upstream code at random points" at [1] and "github
> creates absolutely useless garbage merges" at [2].
>
> If you're seeing users merge main into topic branches without a good
> reason, that does sound like more of an education problem than a
> bad-defaults problem.
I would disagree on two points:
1. The need for merging in the upstream varies project by project,
user by user, etc. If you are working on a part of a system where you
can reasonably assume the ground will not shift under your feet,
awesome, lucky you! Many users are not so fortunate, and need to
regularly ensure that their changes still make sense in the
ever-changing upstream context.

Regularly (whatever that means to you) merging in the upstream is the simplest way of achieving that. If you're working on your own or as part of a team that's happy to handle coordinated rebasing, then rebasing is a potentially-more-satisfying way of achieving the same end - either way, assuming that their changes will make sense in the upstream context is simply not a luxury many users can afford over any period of time.

Now, you note that Linus advocates for merging specific points, because he doesn't respect you merging "random crap" from a branch called "linus" - that's fine, but many projects strive to keep a specific trunk branch "evergreen" in order to minimize late conflicts are maximize coordination - there's a pretty cool site about it: https://trunkbaseddevelopment.com/ - this is not really different to Linus' advice except that the goal is to make there *never* be "random crap" on the upstream.

2. The fact that the commit history of non-expert git users (those who
should not be using rebase, especially in teams) are so often...
spidery... is why the "Squash" option of pull requests / merge
requests is so popular in centralized workflows (GitHub, GitLab,
BitBucket, etc).

If your project follows a "merge down, squash up" strategy with a well-CI-guarded evergreen trunk on a central server, there's simply no reason to *require* your users to become rebasing experts - you can let them use simple merge-based workflows, keep your trunk clean by squashing away their complex commit graphs, let them merge down whenever they need or want to, etc.

> We might still want to change the default to
> better support the more unusual cases, but

Do we have any analysis/understanding of how common workflows like that of the git or linux projects are, vs github-style fork-based projects, vs straight-up single central server projects?

I'm not sure what you mean by "unusual", but I don't think "avoid rebase unless you really know what you're doing, merge down at will, we will squash your contribution in the pull/merge request at the end anyway" is an unusual flow at all nowadays.

> if you're going for a quick
> win, it would be faster to teach users the wisdom of not mixing rebase
> and merge in the first place.
>

"teach [...] wisdom" is a good one! No, seriously - of course I'm going to do the best I can to prevent my users from falling into the traps surrounding them - but my point here is that *we simply shouldn't have pointless traps*. Offering a command that can cause significant "harm" (time loss, frustration, etc), silently... just doesn't seem like a good idea.

> [1] https://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html
> [2] https://lore.kernel.org/lkml/CAHk-=wjbtip559HcMG9VQLGPmkurh5Kc50y5BceL8Q8=aL0H3Q@mail.gmail.com/
Previous: Alex HenrieNext: Alex Henrie
Message 28 of 34 in “pull: conflict hint pull.rebase suggestion should offer "merges" vs "true"”
  1. pull: conflict hint pull.rebase suggestion should offer "merges" vs "true"Tao Klerks via GitGitGadget, Feb 5, 2023
  2. Alex HenrieFeb 16, 2023
  3. Tao KlerksFeb 16, 2023
  4. Alex HenrieFeb 17, 2023
  5. Tao KlerksFeb 17, 2023
  6. Alex HenrieFeb 17, 2023
  7. Junio C HamanoFeb 17, 2023
  8. Elijah NewrenFeb 18, 2023
  9. Phillip WoodFeb 18, 2023
  10. Tao KlerksFeb 20, 2023
  11. Phillip WoodFeb 20, 2023
  12. Elijah NewrenFeb 20, 2023
  13. Tao KlerksFeb 21, 2023
  14. Sergey OrganovFeb 22, 2023
  15. Elijah NewrenFeb 24, 2023
  16. Sergey OrganovFeb 24, 2023
  17. Elijah NewrenFeb 24, 2023
  18. Sergey OrganovFeb 25, 2023
  19. Elijah NewrenFeb 25, 2023
  20. Sergey OrganovFeb 26, 2023
  21. Elijah NewrenFeb 27, 2023
  22. Sergey OrganovFeb 27, 2023
  23. Elijah NewrenFeb 28, 2023
  24. Elijah NewrenFeb 20, 2023
  25. Tao KlerksFeb 20, 2023
  26. Elijah NewrenFeb 20, 2023
  27. Alex HenrieFeb 20, 2023
  28. Tao KlerksFeb 21, 2023
  29. Alex HenrieFeb 21, 2023
  30. Tao KlerksFeb 21, 2023
  31. Elijah NewrenFeb 24, 2023
  32. Felipe ContrerasFeb 28, 2023
  33. Alex HenrieFeb 28, 2023
  34. Felipe ContrerasMar 1, 2023

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.