git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	git@vger.kernel.org, entwicklung@pengutronix.de
Subject: Re: Bug in rebase --autosquash
Date: Fri, 19 Aug 2022 09:53:46 -0700	[thread overview]
Message-ID: <xmqqpmgwmaxx.fsf@gitster.g> (raw)
In-Reply-To: <8p78q4p9-9ro4-p5s4-r738-7sno17rqr414@tzk.qr> (Johannes Schindelin's message of "Fri, 19 Aug 2022 13:09:00 +0200 (CEST)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> This demonstrates a somewhat obscure feature where the `fixup!` of a
> `fixup!` magically targets the original commit.
>
> I understand that it is somewhat unintuitive that `fixup! fixup! abc` does
> not target `fixup! abc` but instead `abc`, but that's how the tool has
> been behaving forever.

It certainly is handy when the original commit A has a fixup commit
B, which gets later fixed up by another commit C, resulting in a
sequence like this:

    $ git rebase -i A~1 C

    pick A original commit
    fixup B fixup! original commit
    fixup C fixup! fixup! original commit

But if the user for some reason finds it is not quite ready to touch
the original commit by squashing in the fixes, it may be reasonable
to want to squash the two fixes together, so that it can later be
applied to the original commit.  And it would be one natural way to
request that with

    $ git rebase -i A C

that is, leave the history up to A intact, but everything above
tweaked.  Without --autosquash, you would get

    pick B fixup! original commit
    pick C fixup! fixup! original commit

and you would manually do

    pick B fixup! original commit
    fixup C fixup! fixup! original commit

to squash B and C together into a single fix-up to be applied
later.  It does not look all too unreasonable to expect the
"--autosquash" feature to do that automatically for you.

Thanks.

    



      reply	other threads:[~2022-08-19 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  9:49 Bug in rebase --autosquash Uwe Kleine-König
2022-08-17 19:40 ` Felipe Contreras
2022-08-19 11:09 ` Johannes Schindelin
2022-08-19 16:53   ` Junio C Hamano [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqpmgwmaxx.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=entwicklung@pengutronix.de \
    --cc=git@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.
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).