git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Philippe Blain <levraiphilippeblain@gmail.com>
Cc: "Git mailing list" <git@vger.kernel.org>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Jonathan Tan" <jonathantanmy@google.com>,
	"Elijah Newren" <newren@gmail.com>
Subject: Re: [RFC] should `git rebase --keep-base` imply `--reapply-cherry-picks` ?
Date: Mon, 13 Jul 2020 23:10:17 -0400	[thread overview]
Message-ID: <20200714031017.GA15143@generichostname> (raw)
In-Reply-To: <0EA8C067-5805-40A7-857A-55C2633B8570@gmail.com>

Hi Philippe,

On Mon, Jul 13, 2020 at 10:44:06PM -0400, Philippe Blain wrote:
> Hello,
> 
> I learned today that doing `git rebase --keep-base master` 
> will drop commits that were cherry-picked from master to the current branch. 
> I was simply doing a code clean up on my feature branch (the full command was
> `git rebase -i --keep-base master`), and this kind of confused me for a moment.

Glad I'm not the only one using this feature :)

> Is this a sane default ? I understand that it is a good default when we are rebasing 
> *on top* of master, but here I'm just doing some squashing and fixup's and I did not
> want the commit I had cherry-picked from master to disappear (yet). In fact, because it
> was dropped, it created a modify/delete conflict because in a subsequent commit 
> in my feature branch I'm modifying files that are added in the commit I cherry-picked.

So if I'm not mistaken, if we have the following graph

	A - B - C - D (master)
	     \
	       - C' - D (feature)

and we do `git rebase --keep-base master` from feature, C' will be
dropped? Indeed, I am surprised by how this interacts with the
default setting of --reapply-cherry-picks.

> How would a change that made '--reapply-cherry-picks' be the default when using 'keep-base'
> be received ?

I'm somewhat surprised that --no-reapply-cherry-picks is the default. I
would argue that it _shouldn't_ be the default at all. It's an
optimisation for when no --onto or --keep-base are specified but it
definitely can cause problems otherwise, as we've seen.

I think I would argue for the following in decreasing order of
preference:

	1. Make --no-reapply-cherry-picks the default in all cases.
	   (Those who need the optimisation can enable it manually and
	   we can add a configuration option for it.)

	2. Make --no-reapply-cherry-picks only active if no --onto or
	   --keep-base are given (--keep-base is a special case of --onto
	   so we only have to handle it in one place).

> Tangential question: in any case, would it make sense to still add the "dropped because 
> already upstream" commits to the todo list, in the case of an interactive rebase ? 
> (maybe commented out, or listed as 'drop' with some kind of comment saying those 
> are dropped because they appear textually upstream?)

That would make sense to me. I don't have a preference between either.

Thanks,

Denton

> Cheers,
> Philippe.
> P.S. I CC'd those who were involved with the 'keep-base' patch or the 'reapply-cherry-picks' patch.

  reply	other threads:[~2020-07-14  3:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14  2:44 [RFC] should `git rebase --keep-base` imply `--reapply-cherry-picks` ? Philippe Blain
2020-07-14  3:10 ` Denton Liu [this message]
2020-07-14  3:51   ` Jonathan Tan
2020-07-15  3:32     ` Denton Liu
2020-07-14  9:52   ` Phillip Wood
2020-07-14 20:38     ` Johannes Schindelin
2020-07-15  3:20       ` Denton Liu
2020-07-15  8:53         ` Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200714031017.GA15143@generichostname \
    --to=liu.denton@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=newren@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).