git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Is there any way to "interrupt" a rebase?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 20, 2018, 11:44 UTC
Message-ID
<nycvar.QRO.7.76.6.1802201240010.31@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
In-Reply-To
<nycvar.QRO.7.76.6.1802201147300.31@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
Hi Hilco,
On Tue, 20 Feb 2018, Johannes Schindelin wrote:
Show 18 quoted lines
> 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.

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

Ciao, Johannes

Previous: Johannes SchindelinNext: Jeff King
Message 5 of 10 in “Is there any way to "interrupt" a rebase?”
  1. Hilco WijbengaFeb 19, 2018
  2. brian m. carlsonFeb 19, 2018
  3. Hilco WijbengaFeb 19, 2018
  4. Johannes SchindelinFeb 20, 2018
  5. Johannes SchindelinFeb 20, 2018
  6. Jeff KingFeb 20, 2018
  7. Jacob KellerFeb 20, 2018
  8. Phillip WoodFeb 23, 2018
  9. Jeff KingFeb 20, 2018
  10. Phillip WoodFeb 20, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.