# After a rebase, ORIG_HEAD points to the previous tip of the branch?

2 messages from 2018-04-08 to 2018-04-08. Participants: Ilya Kantor, Junio C Hamano.
Thread: https://gitlist.dev/t/48243

## Ilya Kantor, 2018-04-08 21:10

Subject: After a rebase, ORIG_HEAD points to the previous tip of the branch?
Message-ID: <CAFU8umhSAufzbPBDMVt4ekcWjPa4Yymh+NeW=BYa8ARuRuZcbw@mail.gmail.com>
URL: https://gitlist.dev/e/CAFU8umhSAufzbPBDMVt4ekcWjPa4Yymh%2BNeW%3DBYa8ARuRuZcbw%40mail.gmail.com

```
Hi,

Immediately after a finished rebase, is it true that ORIG_HEAD points
to the previous tip of the branch?

So that `git reset --hard ORIG_HEAD` will cancel the rebase?

P.S. I'm asking because most of time that is so, but there is at least
one case when ORIG_HEAD breaks that assumption. Not sure if it's a bug
or not.

---
Best Regards,
Ilya Kantor

```

## Junio C Hamano, 2018-04-08 23:04

Subject: Re: After a rebase, ORIG_HEAD points to the previous tip of the branch?
Message-ID: <xmqqy3hx8fmb.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqy3hx8fmb.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <CAFU8umhSAufzbPBDMVt4ekcWjPa4Yymh+NeW=BYa8ARuRuZcbw@mail.gmail.com>

```
Ilya Kantor <iliakan@gmail.com> writes:

> Immediately after a finished rebase, is it true that ORIG_HEAD points
> to the previous tip of the branch?
>
> So that `git reset --hard ORIG_HEAD` will cancel the rebase?

I wouldn't recommend people to depend on it; rather use "@{1}",
perhaps?

Before reflog was invented, ORIG_HEAD was primarily a handy way to
back out of "reset", but because the implementation of higher-level
porcelains like "rebase" may internally use things like "reset"
without giving it much thought about clobber ingORIG_HEAD (largely
because there is an expectation that modern end users would be using
reflog more than old-way ORIG_HEAD), cases like stopping in conflict
and getting told to skip and continue may not preserve ORIG_HEAD as
you wish it to.

```
