public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Brian Gernhardt <benji@silverinsanity•com>
Cc: Git List <git@vger•kernel.org>
Subject: Re: [FIXED PATCH] Make rebase save ORIG_HEAD if changing current branch
Date: Sun, 06 Jul 2008 23:48:27 -0700	[thread overview]
Message-ID: <7vod5a6vgk.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vbq1a8ay3.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Sun, 06 Jul 2008 23:28:36 -0700")

Junio C Hamano <gitster@pobox•com> writes:

> Brian Gernhardt <benji@silverinsanity•com> writes:
>
>> My final thought is that the rational ORIG_HEAD and when we set it is
>> not clearly documented anywhere.  But I am currently out of time to
>> work on git, so that patch won't be coming from me soon.
>
> The idea behind ORIG_HEAD is to have an anchoring point before an
> operation that moves your HEAD in a drastic way.  Think if it as a
> poor-man's reflog -- in fact it predates reflog.
>
> That is why reset saves away the HEAD before it does its thing, so that
> you can easily say "Oops, I did not mean it -- reset ORIG_HEAD" to flip
> back to the previous state.  Both a fast-forward merge and a real merge
> can be undone by resetting back to ORIG_HEAD.
>
> So in that sense:
>
>  (1) ORIG_HEAD is not strictly necessary these days, because we have
>      reflogs;
>
>  (2) Even then, it is handy and useful, and we could add ORIG_HEAD to more
>      commands such as "git am" and "git rebase".

Perhaps something like this for "git am" (only minimally tested).

-- >8 --
am: record ORIG_HEAD so that we can quickly undo a large series

This teaches "git-am" to record the commit before it starts its work in
ORIG_HEAD, so that application of a large series can be undone by
resetting to it.

Signed-off-by: Junio C Hamano <gitster@pobox•com>
---
 git-am.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index 2c517ed..818b4e5 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -242,6 +242,7 @@ else
 	else
 		: >"$dotest/applying"
 	fi
+	git update-ref ORIG_HEAD HEAD
 fi
 
 case "$resolved" in

  reply	other threads:[~2008-07-07  6:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-06 21:22 [FIXED PATCH] Make rebase save ORIG_HEAD if changing current branch Brian Gernhardt
2008-07-07  4:43 ` Junio C Hamano
2008-07-07  5:16   ` Brian Gernhardt
2008-07-07  5:24     ` Junio C Hamano
2008-07-07  6:28     ` Junio C Hamano
2008-07-07  6:48       ` Junio C Hamano [this message]
2008-07-07 11:18       ` Theodore Tso
2008-07-07 11:42         ` Jakub Narebski
2008-07-07 15:03           ` Brian Gernhardt
2008-07-08  4:26             ` Jeff King
2008-07-08 14:32               ` Brian Gernhardt
2008-07-07 14:36         ` Brian Gernhardt
2008-07-07 18:04         ` Junio C Hamano
2008-07-07 21:58       ` Junio C Hamano
2008-07-07 22:14         ` Jakub Narebski
2008-07-07 22:33           ` Junio C Hamano
2008-07-07 22:58             ` Jakub Narebski
2008-07-08  3:24         ` Brian Gernhardt
2008-07-08  4:12           ` [PATCH] Documentation: mention ORIG_HEAD in am, merge, and rebase Brian Gernhardt
2008-07-08 19:23             ` Junio C Hamano
2008-07-08 19:28               ` Brian Gernhardt
2008-07-08  3:28         ` [FIXED PATCH] Make rebase save ORIG_HEAD if changing current branch Jay Soffian
2008-07-07  5:41   ` Mike Hommey
2008-07-07  5:46     ` Junio C Hamano
2008-07-07  5:48     ` Mike Hommey
2008-07-07  6:14   ` Nanako Shiraishi
2008-07-07  7:16     ` Re* " Junio C Hamano
2008-07-07 14:36       ` Brian Gernhardt

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=7vod5a6vgk.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox$(echo .)com \
    --cc=benji@silverinsanity$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox