From: Junio C Hamano <gitster@pobox.com>
To: Nanako Shiraishi <nanako3@lavabit.com>
Cc: Brian Gernhardt <benji@silverinsanity.com>,
Git List <git@vger.kernel.org>
Subject: Re* [FIXED PATCH] Make rebase save ORIG_HEAD if changing current branch
Date: Mon, 07 Jul 2008 00:16:38 -0700 [thread overview]
Message-ID: <7vvdzi5fl5.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20080707151401.6117@nanako3.lavabit.com
Nanako Shiraishi <nanako3@lavabit.com> writes:
> Quoting Junio C Hamano <gitster@pobox.com>:
> ...
>> Having said that, thanks to updates to git-rebase, rebased_branch@{1} has
>> useful information these days, so I do not see much practical upside, even
>> though I _will_ apply this patch, just for the sake of consistency.
>
> Are you really aiming for consistency, Junio?
>
> Doesn't this make the behavior of the command inconsistent between
> "git-rebase" and "git-rebase -m"?
Hmm, it makes "rebase -i" different, too. Luckily, I haven't pushed
anything out, so I can rewind and all I lose is just a few dozens of
minutes.
The one from Brian has another serious issue. That patch does not allow
you to refer to ORIG_HEAD during conflict resolution, which is quite
different from how "merge" lets you use ORIG_HEAD. We need to set
ORIG_HEAD upfront if we want to tell user that ORIG_HEAD can be reliably
used across workflows the same way to name where we were before.
When we correctly update "rebase" to do this, because one codepath of it
uses "am" as its backend, we cannot use the patch I sent out earlier. We
probably need to do something like this (minimally tested).
-- >8 --
Teach "am" and "rebase" to mark the original position with ORIG_HEAD
"merge" and "reset" leave the original point in history in ORIG_HEAD,
which makes it easy to go back to where you were before you inflict a
major damage to your history and realize that you do not like the result
at all. These days with reflog, we technically do not need to use
ORIG_HEAD, but it is a handy way nevertheless.
This teaches "am" and "rebase" (all forms --- the vanilla one that uses
"am" as its backend, "-m" variant that cherry-picks, and "--interactive")
to do the same.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
git-am.sh | 1 +
git-rebase--interactive.sh | 1 +
git-rebase.sh | 2 +-
3 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index 2c517ed..fe53608 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -241,6 +241,7 @@ else
: >"$dotest/rebasing"
else
: >"$dotest/applying"
+ git update-ref ORIG_HEAD HEAD
fi
fi
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a64d9d5..02d7e3c 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -549,6 +549,7 @@ EOF
has_action "$TODO" ||
die_abort "Nothing to do"
+ git update-ref ORIG_HEAD $HEAD
output git checkout $ONTO && do_rest
;;
esac
diff --git a/git-rebase.sh b/git-rebase.sh
index e2d85ee..2597d77 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -378,7 +378,7 @@ fi
echo "First, rewinding head to replay your work on top of it..."
git checkout "$onto^0" >/dev/null 2>&1 ||
die "could not detach HEAD"
-# git reset --hard "$onto^0"
+git update-ref ORIG_HEAD $branch
# If the $onto is a proper descendant of the tip of the branch, then
# we just fast forwarded.
next prev parent reply other threads:[~2008-07-07 7:17 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
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 ` Junio C Hamano [this message]
2008-07-07 14:36 ` Re* " 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=7vvdzi5fl5.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=benji@silverinsanity.com \
--cc=git@vger.kernel.org \
--cc=nanako3@lavabit.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.
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 NNTP newsgroup(s).