aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-07-14 23:45:49 -0700
committerJunio C Hamano <gitster@pobox.com>2008-07-14 23:45:49 -0700
commit633ce9a3ba973acf19a122e1359b7ae724887d70 (patch)
treed360db37cc2c4f64ed85eae77e03f2b98061c9b1
parent055767194c15f9b7c39a509daf1a77472c77bed8 (diff)
parent9869099bee332e4c351c3aaa15a74786d85909c7 (diff)
downloadgit-633ce9a3ba973acf19a122e1359b7ae724887d70.tar.gz
git-633ce9a3ba973acf19a122e1359b7ae724887d70.tar.xz
Merge branch 'jc/rebase-orig-head'
* jc/rebase-orig-head: Documentation: mention ORIG_HEAD in am, merge, and rebase Teach "am" and "rebase" to mark the original position with ORIG_HEAD
-rw-r--r--Documentation/git-am.txt6
-rw-r--r--Documentation/git-merge.txt4
-rw-r--r--Documentation/git-rebase.txt3
-rwxr-xr-xgit-am.sh1
-rwxr-xr-xgit-rebase--interactive.sh1
-rwxr-xr-xgit-rebase.sh2
6 files changed, 14 insertions, 3 deletions
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index eeb23b25b..1395c7d98 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -145,6 +145,12 @@ directory exists, so if you decide to start over from scratch,
run `rm -f -r .dotest` before running the command with mailbox
names.
+Before any patches are applied, ORIG_HEAD is set to the tip of the
+current branch. This is useful if you have problems with multiple
+commits, like running 'git am' on the wrong branch or an error in the
+commits that is more easily fixed by changing the mailbox (e.g.
+errors in the "From:" lines).
+
SEE ALSO
--------
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 62f99b5f3..019e4ca8f 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -81,7 +81,9 @@ Otherwise, merge will refuse to do any harm to your repository
(that is, it may fetch the objects from remote, and it may even
update the local branch used to keep track of the remote branch
with `git pull remote rbranch:lbranch`, but your working tree,
-`.git/HEAD` pointer and index file are left intact).
+`.git/HEAD` pointer and index file are left intact). In addition,
+merge always sets `.git/ORIG_HEAD` to the original state of HEAD so
+a problematic merge can be removed by using `git reset ORIG_HEAD`.
You may have local modifications in the working tree files. In
other words, 'git-diff' is allowed to report changes.
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index f3459c7de..e30f6a698 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -26,7 +26,8 @@ of commits that would be shown by `git log <upstream>..HEAD`.
The current branch is reset to <upstream>, or <newbase> if the
--onto option was supplied. This has the exact same effect as
-`git reset --hard <upstream>` (or <newbase>).
+`git reset --hard <upstream>` (or <newbase>). ORIG_HEAD is set
+to point at the tip of the branch before the reset.
The commits that were previously saved into the temporary area are
then reapplied to the current branch, one by one, in order. Note that
diff --git a/git-am.sh b/git-am.sh
index 4e73f93a1..52b5669b4 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -242,6 +242,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 3d85486c8..a35212d9d 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -574,6 +574,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 e2d85eeea..2597d777d 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.