All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Erik Cervin Edin <erik@cervined.in>,
	Phillip Wood <phillip.wood@dunelm.org.uk>,
	Philippe Blain <levraiphilippeblain@gmail.com>
Subject: Re: [PATCH 5/5] git-rebase.txt: add a note about 'ORIG_HEAD' being overwritten
Date: Sun, 08 Jan 2023 11:16:45 +0900	[thread overview]
Message-ID: <xmqq4jt122k2.fsf@gitster.g> (raw)
In-Reply-To: <9ef427a9a2adfb6a47d13103f00a64df96725560.1673120359.git.gitgitgadget@gmail.com> (Philippe Blain via GitGitGadget's message of "Sat, 07 Jan 2023 19:39:19 +0000")

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> 'ORIG_HEAD' is written at the start of the rebase, but is not guaranteed
> to still point to the original branch tip at the end of the rebase.
>
> Indeed, using other commands that write 'ORIG_HEAD' during the rebase,
> like splitting a commit using 'git reset HEAD^', will lead to 'ORIG_HEAD'
> being overwritten.

Is that a news?  If a user does "reset", the user is asking that
HEAD is changed and the old state kept in ORIG_HEAD at the same
time, so while it is not wrong per-se to say that user can clobber
ORIG_HEAD after rebase sets it first, it is pretty much expected,
no?

What would be unexpected is if "rebase" overwrote ORIG_HEAD after
user did all these other things while it gave control back and then
it took control back, and it would be worth documenting.

Having said that, I do not mind documenting this.  I am not sure "is
not guaranteed" is a good way to phrase what happens, though.

> +[NOTE]
> +`ORIG_HEAD` is not guaranteed to still point to the previous branch tip
> +at the end of the rebase if other commands that write that pseudo-ref
> +(e.g. `git reset`) are used during the rebase. The previous branch tip,
> +however, is accessible using the reflog of the current branch
> +(i.e. `@{1}`, see linkgit:gitrevisions[7]).

    `ORIG_HEAD` is set to point at the tip of the previous branch
    when `rebase` begins, but the user can run commands (e.g. "git
    reset") that overwrites `ORIG_HEAD` while `rebase` gives control
    to the user (e.g. while asking to resolve conflict).

It is excellent to mention reflog, which is very much an upward
compatible replacement of ORIG_HEAD.

Thanks.

  reply	other threads:[~2023-01-08  2:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 19:39 [PATCH 0/5] Documentation: updates and a correction around 'ORIG_HEAD' Philippe Blain via GitGitGadget
2023-01-07 19:39 ` [PATCH 1/5] git-cherry-pick.txt: do not use 'ORIG_HEAD' in example Philippe Blain via GitGitGadget
2023-01-08  2:05   ` Junio C Hamano
2023-01-09 13:56     ` Philippe Blain
2023-01-07 19:39 ` [PATCH 2/5] git-reset.txt: mention 'ORIG_HEAD' in the Description Philippe Blain via GitGitGadget
2023-01-07 19:39 ` [PATCH 3/5] git-merge.txt: " Philippe Blain via GitGitGadget
2023-01-07 19:39 ` [PATCH 4/5] revisions.txt: be explicit about commands writing 'ORIG_HEAD' Philippe Blain via GitGitGadget
2023-01-08  2:08   ` Junio C Hamano
2023-01-09 14:00     ` Philippe Blain
2023-01-07 19:39 ` [PATCH 5/5] git-rebase.txt: add a note about 'ORIG_HEAD' being overwritten Philippe Blain via GitGitGadget
2023-01-08  2:16   ` Junio C Hamano [this message]
2023-01-09 18:22     ` Philippe Blain
2023-01-10 13:15 ` [PATCH v2 0/5] Documentation: updates and a correction around 'ORIG_HEAD' Philippe Blain via GitGitGadget
2023-01-10 13:15   ` [PATCH v2 1/5] git-cherry-pick.txt: do not use 'ORIG_HEAD' in example Philippe Blain via GitGitGadget
2023-01-10 13:15   ` [PATCH v2 2/5] git-reset.txt: mention 'ORIG_HEAD' in the Description Philippe Blain via GitGitGadget
2023-01-10 13:15   ` [PATCH v2 3/5] git-merge.txt: " Philippe Blain via GitGitGadget
2023-01-10 13:15   ` [PATCH v2 4/5] revisions.txt: be explicit about commands writing 'ORIG_HEAD' Philippe Blain via GitGitGadget
2023-01-10 13:15   ` [PATCH v2 5/5] git-rebase.txt: add a note about 'ORIG_HEAD' being overwritten Philippe Blain via GitGitGadget
2023-01-10 20:06   ` [PATCH v2 0/5] Documentation: updates and a correction around 'ORIG_HEAD' Phillip Wood
2023-01-13 17:56     ` Junio C Hamano

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=xmqq4jt122k2.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=erik@cervined.in \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.