git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood@talktalk.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Hilco Wijbenga <hilco.wijbenga@gmail.com>
Cc: Git Users <git@vger.kernel.org>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Jeff King <peff@peff.net>, Jacob Keller <jacob.keller@gmail.com>
Subject: Re: Is there any way to "interrupt" a rebase?
Date: Fri, 23 Feb 2018 13:12:37 +0000	[thread overview]
Message-ID: <041177b6-e33b-085c-5546-56dbdec75fa3@talktalk.net> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1802201240010.31@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>

On 20/02/18 11:44, Johannes Schindelin wrote:
> 
> Hi Hilco,
> 
> On Tue, 20 Feb 2018, Johannes Schindelin wrote:
> 
>> When I am particularly tired and overworked (and therefore know that my
>> working memory is less useful than usual), I therefore resort to my
>> second-favorite strategy: U use the `done` file.
>>
>> I literally copy parts of $GIT_DIR/rebase-merge/done to the beginning of
>> $GIT_DIR/rebase-merge/git-rebase-todo (the most convenient way to open the
>> latter is `git rebase --edit-todo`). In your case, those would be the
>> `pick` lines cherry-picking D and E. Then, as before, `git reset --hard
>> <commit>` (where I look up the `<commit>` using an aliased version of `git
>> log --graph --oneline --left-right --boundary`), amend the commit, and
>> then `git rebase --continue`.
>>
>> It might be even possible to design a new subcommand for the interactive
>> rebase to facilitate a variation of this strategy (possibly even making
>> use of the fact that the interactive rebase accumulates mappings between
>> the original commits and the rewritten ones in
>> $GIT_DIR/rebase-merge/rewritten-list, intended for use in the post-rewrite
>> hook).
> 
> This feature might look somewhat like this:
> 
> 	git rebase --replay-latest-commits 3
> 
> and it would not even have to look at the `rewritten-list`. All it would
> do is to put back the latest `pick` from the `done` file (in case of merge
> conflicts) into the `git-rebase-todo` file, then insert `pick lines for
> HEAD~3.. at the beginning of that todo file, and then `git reset --hard
> HEAD~3`.
> 
> By not using the original lines from the `done` file (i.e. *different*
> from what I described as my second-favorite strategy), you would also get
> the resolved merge conflicts rather than having to re-resolve them.

Yes that's why I prefer using pasting the output of git log rather than
bits of rebase-merge/done into the todo list when rewinding manually.

> 
> (This all would of course only work properly without --preserve-merges and
> without the upcoming --recreate-merges.)

It shouldn't be too hard to support --recreate-merges in the case where
you don't go past a merge commit, one would just have to check
refs/rewritten to see if any label commands need to be inserted.

Best Wishes

Phillip

> Ciao,
> Johannes
> 


  parent reply	other threads:[~2018-02-23 13:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 19:35 Is there any way to "interrupt" a rebase? Hilco Wijbenga
2018-02-19 22:36 ` brian m. carlson
2018-02-19 23:09   ` Hilco Wijbenga
2018-02-20 11:03     ` Johannes Schindelin
2018-02-20 11:44       ` Johannes Schindelin
2018-02-20 20:56         ` Jeff King
2018-02-20 22:40           ` Jacob Keller
2018-02-23 13:12         ` Phillip Wood [this message]
2018-02-20  3:50 ` Jeff King
2018-02-20 10:20 ` 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=041177b6-e33b-085c-5546-56dbdec75fa3@talktalk.net \
    --to=phillip.wood@talktalk.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=hilco.wijbenga@gmail.com \
    --cc=jacob.keller@gmail.com \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sandals@crustytoothpaste.net \
    /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).