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

Re: [PATCH 1/4] rebase -i: stop overwriting ORIG_HEAD buffer

From
Hherr.kaste <herr.kaste@gmail.com>
Date
Nov 2, 2020, 19:40 UTC
Message-ID
<CAFzd1+7wzPZa9brWzWzSQdcMEnbEcV28zqBBAV_rsdsKNaKaFg@mail.gmail.com>
In-Reply-To
<xmqq7drbbcj5.fsf@gitster.c.googlers.com>
Am Di., 27. Okt. 2020 um 22:10 Uhr schrieb Junio C Hamano <gitster@pobox.com>:
Show 11 quoted lines
>
> My initial impression after seeing the recent report about ORIG_HEAD
> was "hmph, these days, rebasing is done on detached HEAD and the
> final step updates the target branch only once, so @{1} is much
> easier to use---perhaps it is time to deprecate use of ORIG_HEAD?".
> After all, ORIG_HEAD was invented way before we had reflog, and
> given that one of the goal of reflog was to give more general
> recovery mechanism than going back one-step like ORIG_HEAD allowed
> us to, and "rebase" were taught to work on detached HEAD to make
> @{1} more useful, it would not be too bad to eventually retire
> ORIG_HEAD in a distant future, I thought.

Phillip pointed out that ORIG_HEAD is actually not save *if* there is a `reset` or `rebase --skip` during the rebase. Otherwise, by design, ORIG_HEAD would be easier to use, as in the form `<branch_name>@{<n>}` two things have to be decided and can go wrong.

Wouldn't it be better for the mid-term run to set ORIG_HEAD at the end of the rebase operation, basically during cleanup, and make the commitment that it always points to the right thing for undoing the recent rebase or to compare it (`git diff ORIG_HEAD`) to see possible unwanted merge resolutions.

I say mid-term because a `git rebase --undo` with additional safety checks and a `--autostash` for example is IMO the better long-run UX, in a very distant future.

>
> But it is a good initiative anyway to make ORIG_HEAD again work as
> documented.  Thanks for working on it.
>

Regards Caspar Duregger

Previous: Phillip WoodNext: Junio C Hamano
Message 7 of 15 in “rebase -i: fix ORIG_HEAD handling”
  1. 0/4 rebase -i: fix ORIG_HEAD handlingPhillip Wood via GitGitGadget, Oct 27, 2020
  2. 4/4 rebase -i: simplify get_revision_ranges()Phillip Wood via GitGitGadget, Oct 27, 2020
  3. 3/4 rebase -i: use struct object_id when writing statePhillip Wood via GitGitGadget, Oct 27, 2020
  4. 1/4 rebase -i: stop overwriting ORIG_HEAD bufferPhillip Wood via GitGitGadget, Oct 27, 2020
  5. Junio C HamanoOct 27, 2020
  6. Phillip WoodOct 31, 2020
  7. herr.kasteNov 2, 2020
  8. Junio C HamanoNov 3, 2020
  9. herr.kasteNov 3, 2020
  10. 2/4 rebase -i: use struct object_id rather than looking up commitPhillip Wood via GitGitGadget, Oct 27, 2020
  11. 0/4 rebase -i: fix ORIG_HEAD handlingPhillip Wood via GitGitGadget, Nov 4, 2020
  12. 1/4 rebase -i: stop overwriting ORIG_HEAD bufferPhillip Wood via GitGitGadget, Nov 4, 2020
  13. 3/4 rebase -i: use struct object_id when writing statePhillip Wood via GitGitGadget, Nov 4, 2020
  14. 4/4 rebase -i: simplify get_revision_ranges()Phillip Wood via GitGitGadget, Nov 4, 2020
  15. 2/4 rebase -i: use struct object_id rather than looking up commitPhillip Wood via GitGitGadget, Nov 4, 2020

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.