From: Phillip Wood <phillip.wood123@gmail.com>
To: "herr.kaste" <herr.kaste@gmail.com>, git@vger.kernel.org
Subject: Re: ORIG_HEAD after rebase is confusing
Date: Mon, 26 Oct 2020 10:43:22 +0000 [thread overview]
Message-ID: <8bb82be6-dc51-6602-47b5-c849a87ae55e@gmail.com> (raw)
In-Reply-To: <CAFzd1+62PmHBoVpMw-y4TC=bmc8N0wDpF2jQa7XGz2e+7Dos6A@mail.gmail.com>
Hi Caspar
On 22/10/2020 21:31, herr.kaste wrote:
> Reading the git rebase manual and some answer on stackoverflow I assumed
> `ORIG_HEAD` will point to the original HEAD, the tip of the branch *before*
> I started rebasing. But it doesn't seem so.
>
> For example, I have this:
>
>
> $ git log --graph --all --oneline
> * 9830f9f (master) X
> | * fb7b6a6 (HEAD -> feature) D
> | * 46b7a7a C
> | * da5e4c7 B
> | * 5c135da A
> |/
> * 6848823 Init
>
> $ git rebase master
> Successfully rebased and updated refs/heads/feature.
>
> $ git rev-parse ORIG_HEAD
> da5e4c7e9eb3b10c1efa08c534b9c9e4b92d9fd7
>
> $ git reflog
> a647bd7 (HEAD -> feature) HEAD@{0}: rebase (finish): returning to
> refs/heads/feature
> a647bd7 (HEAD -> feature) HEAD@{1}: rebase (pick): D
> 2f458e8 HEAD@{2}: rebase (pick): C
> 0aa2160 HEAD@{3}: rebase (pick): B
> b957fc7 HEAD@{4}: rebase (pick): A
> 9830f9f (master) HEAD@{5}: rebase (start): checkout master
> fb7b6a6 HEAD@{6}: checkout: moving from master to feature
> 9830f9f (master) HEAD@{7}: commit: X
> 6848823 HEAD@{8}: checkout: moving from feature to master
> fb7b6a6 HEAD@{9}: commit: D
> 46b7a7a HEAD@{10}: commit: C
> da5e4c7 HEAD@{11}: commit: B
> 5c135da HEAD@{12}: commit: A
> 6848823 HEAD@{13}: checkout: moving from master to feature
> 6848823 HEAD@{14}: commit (initial): Init
>
> So `ORIG_HEAD` here points to the original B commit. (I expected the D.)
It should be D, unless you ran `git reset` or `git rebase --skip` while
you were rebasing as they also update ORIG_HEAD
> Honestly, this doesn't make much sense to me in that I don't know *why* it
> even chooses B which is a middle commit in the chain. (And from reading the
> source `sequencer.c` I can't deduce it either.)
>
> $ git --version
> git version 2.29.0.windows.1
>
> What I actually wanted to do was `git reset --hard ORIG_HEAD` fwiw. And for
> example `git diff HEAD..ORIG_HEAD` to check for unwanted changes after a merge
> conflict.
After you rebase you can user feature@{1} to get the head of feature
before rebasing (until you make another commit on feature)
Best Wishes
Phillip
> Regards,
> Caspar Duregger
>
next prev parent reply other threads:[~2020-10-26 10:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 20:31 ORIG_HEAD after rebase is confusing herr.kaste
2020-10-26 10:43 ` Phillip Wood [this message]
2020-10-26 11:29 ` herr.kaste
2020-10-26 11:45 ` herr.kaste
2020-10-26 16:42 ` 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
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=8bb82be6-dc51-6602-47b5-c849a87ae55e@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=herr.kaste@gmail.com \
/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).