From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: George Spelvin <lkml@SDF.ORG>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: Feature request: rebase -i inside of rebase -i
Date: Sat, 21 Mar 2020 11:51:10 +0100 (CET) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.2003211135380.46@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20200320233528.GB19579@SDF.ORG>
Hi,
On Fri, 20 Mar 2020, George Spelvin wrote:
> On Fri, Mar 20, 2020 at 03:51:20PM -0700, Junio C Hamano wrote:
> > I thought that "git rebase -i" allows the todo file (i.e. list of
> > steps still to be performed) to be edited before continuing; would
> > your use case be supported by using that?
>
> Mostly, if I do it very carefully, which is why I thought it would
> be easy to add.
>
> I think I could manually add the commits to the start of the todo file,
> reset --hard to the old state, and rebase --continue.
>
> But cutting and pasting commit IDs from git log into the todo file,
> and putting fixup commits in the right place is annoyingly fiddly.
> That's exactly the sort of thing computers are good at.
FWIW I have a super-hacky work-around for this use case that I am using in
my automation of continuously rebasing Git for Windows' `master` onto the
four integration branches of git.git:
1. create a throw-away worktree without checking out the commit
2. fake-run a new `rebase -i` in that worktree, with a custom "editor"
(which is actually the same script) that simply consumes the todo list,
aborts the `rebase -i` in the worktree, then deletes the worktree, and
then inserts that todo list in the original todo list.
3. continue the rebase
I never got around to implement that as a proper "nested" mode of `git
rebase -i`, but it should not be too hard. The user interface would
probably look somewhat like `git rebase -i --nested <arguments>...` and it
would _expect_ an active interactive rebase, and it would insert the todo
list into the existing one, at the beginning, with proper commenting, then
reset `HEAD` after the user edited the todo list.
My biggest caveat is that I had to force-exit the rebase at some stage
due to reasons I only vaguely remember. It had something to do with the
replacement cache not being updated when an `exec` is executed that adds a
replacement object via `git replace` [*1*]. This issue might have
_nothing_ to do with nested rebases, but as I said, my recollection is
vague.
There are a couple more concerns, of course, such as: what to do if the
user deletes the entire todo list (which is traditionally the only way to
abort a rebase)? My gut feeling is that it should go back to the
_previous_ version of the todo list.
Another big concern is what to do about `rebase.missingCommitsCheck`: with
nested rebases, this will get increasingly tricky. Like, imagine you are
rebasing 5 commits, the third of them results in merge conflicts, you
realize that it is obsolete and so is now the first, already rebased
commit. You do a nested rebase of the latest two commits to drop them, but
they don't have their original commit hashes any longer. So it gets a bit
finicky to keep track of what commit has been dropped on purpose and what
was forgotten to pick instead.
Ciao,
Dscho
Footnote *1*: to refresh my recollection, I would have to scour the
history of the automation script, see
https://github.com/git-for-windows/build-extra/commits/master/ever-green.sh
next prev parent reply other threads:[~2020-03-21 10:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 22:30 Feature request: rebase -i inside of rebase -i George Spelvin
2020-03-20 22:51 ` Junio C Hamano
2020-03-20 23:35 ` George Spelvin
2020-03-21 10:51 ` Johannes Schindelin [this message]
2020-03-21 17:56 ` George Spelvin
2020-03-25 19:26 ` Johannes Schindelin
2020-03-26 0:18 ` George Spelvin
2020-03-28 14:25 ` Johannes Schindelin
2020-03-28 16:30 ` George Spelvin
2020-03-31 0:00 ` George Spelvin
2020-03-31 10:57 ` Philip Oakley
2020-03-31 13:36 ` Phillip Wood
2020-04-01 16:43 ` Philip Oakley
2020-04-07 15:54 ` Phillip Wood
2020-04-04 12:17 ` Johannes Schindelin
2020-04-04 12:39 ` Johannes Schindelin
2020-04-04 17:41 ` George Spelvin
2020-04-06 10:40 ` Sebastien Bruckert
2020-04-06 15:24 ` George Spelvin
2020-04-07 9:16 ` Sebastien Bruckert
2020-04-07 19:03 ` George Spelvin
2020-03-30 14:01 ` Philip Oakley
2020-03-30 18:18 ` George Spelvin
2020-03-30 21:53 ` Philip Oakley
2020-03-21 8:47 ` Johannes Sixt
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=nycvar.QRO.7.76.6.2003211135380.46@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=lkml@SDF.ORG \
/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).