git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Defaulting --rebase-merges overall?
@ 2023-02-03 18:19 Tao Klerks
  2023-02-03 21:09 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Klerks @ 2023-02-03 18:19 UTC (permalink / raw)
  To: git

Hi folks,

I've had a couple of users recently be bitten by "git rebase"'s
default handling of merge commits:

* One user had selected the "git config pull.rebase true" option from
the "Need to specify how to reconcile divergent branches" pull
conflict hint text, without understanding enough about what that
meant: that if they do a "pull" right after having done a (non-ff)
"merge", their commit history would get mangled with a set of
duplicated commits.

* The other was using a GUI (Intellij IDEA), which offered to rebase
when there was a push conflict, but didn't mention or do anything
special about the fact that the single commit to be rebased on a push
conflict was a merge commit (same consequences)

In terms of "quick wins" to help these users avoid the trap they fell
into, I can think of two "quick wins":
1. Change the "Need to specify how to reconcile divergent branches"
pull conflict hint text to offer "git config pull.rebase merges"
instead of "git config pull.rebase true"
2. Offer a global "--rebase-merges by default" config option (I know
there is already a per-branch option, but that's really not very
effective when people are creating new branches all the time)

I've scanned the archives of the last year or two and can't find any
chatter or activity around this - does anyone have an opinion
regarding either of these approaches?

Ideally I'd like to do both. The hint change for people who follow the
hint without understanding the dangers, and the global config option
for people who understand this historical weirdness of rebase and
would rather see the back of it, now that "--rebase-merges" exists and
improves rebase behavior for most users under most circumstances.
Presumably with such a global config option we would also need a
"--no-rebase-merges" option to counter its effect on-demand?

As I think about it, the global option sounds like it might be hard to
prove the correctness of (and compatibility with the hosts of other
options), so I probably won't be qualified to do this. Is there any
objection to the simple hint change, at least?

Thanks,
Tao

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Defaulting --rebase-merges overall?
  2023-02-03 18:19 Defaulting --rebase-merges overall? Tao Klerks
@ 2023-02-03 21:09 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2023-02-03 21:09 UTC (permalink / raw)
  To: Tao Klerks; +Cc: git

Tao Klerks <tao@klerks.biz> writes:

> 1. Change the "Need to specify how to reconcile divergent branches"
> pull conflict hint text to offer "git config pull.rebase merges"
> instead of "git config pull.rebase true"
> ...
> As I think about it, the global option sounds like it might be hard to
> prove the correctness of (and compatibility with the hosts of other
> options), so I probably won't be qualified to do this. Is there any
> objection to the simple hint change, at least?

I think suggesting "[pull] rebase = merges" is more in line with the
original spirit of suggesting "you want to recreate your work on top
of the updated upstream".

I do not particularly find it a good idea to suggest configuring
"git pull" to always rebase (whether it rebases with mergesor
flattens) in the first place, but if we were to offer such an option
anyway, "merges" is a much better choice than "true" to flatten,
simply because that matches the goal of "to recreate your work on
top of the updated upstream" better.

The only reason why 'true' is in the suggestion is because 'merges'
came much later than "when tried to pull and got a conflict, you'd
rebuild your work on top of theirs" suggestion was introduced.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-03 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 18:19 Defaulting --rebase-merges overall? Tao Klerks
2023-02-03 21:09 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).