Skip to content

Commit fa5958f

Browse files
committed
Merge branch 'pb/doc-orig-head' into maint-2.39
Document ORIG_HEAD a bit more. * pb/doc-orig-head: git-rebase.txt: add a note about 'ORIG_HEAD' being overwritten revisions.txt: be explicit about commands writing 'ORIG_HEAD' git-merge.txt: mention 'ORIG_HEAD' in the Description git-reset.txt: mention 'ORIG_HEAD' in the Description git-cherry-pick.txt: do not use 'ORIG_HEAD' in example
2 parents 4f8ab59 + f1c9243 commit fa5958f

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

Documentation/git-cherry-pick.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ again, this time exercising more care about matching up context lines.
219219
------------
220220
$ git cherry-pick topic^ <1>
221221
$ git diff <2>
222-
$ git reset --merge ORIG_HEAD <3>
222+
$ git cherry-pick --abort <3>
223223
$ git cherry-pick -Xpatience topic^ <4>
224224
------------
225225
<1> apply the change that would be shown by `git show topic^`.

Documentation/git-merge.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Then "`git merge topic`" will replay the changes made on the
3737
`topic` branch since it diverged from `master` (i.e., `E`) until
3838
its current commit (`C`) on top of `master`, and record the result
3939
in a new commit along with the names of the two parent commits and
40-
a log message from the user describing the changes.
40+
a log message from the user describing the changes. Before the operation,
41+
`ORIG_HEAD` is set to the tip of the current branch (`C`).
4142

4243
------------
4344
A---B---C topic

Documentation/git-rebase.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ The current branch is reset to `<upstream>` or `<newbase>` if the
3838
`git reset --hard <upstream>` (or `<newbase>`). `ORIG_HEAD` is set
3939
to point at the tip of the branch before the reset.
4040

41+
[NOTE]
42+
`ORIG_HEAD` is not guaranteed to still point to the previous branch tip
43+
at the end of the rebase if other commands that write that pseudo-ref
44+
(e.g. `git reset`) are used during the rebase. The previous branch tip,
45+
however, is accessible using the reflog of the current branch
46+
(i.e. `@{1}`, see linkgit:gitrevisions[7]).
47+
4148
The commits that were previously saved into the temporary area are
4249
then reapplied to the current branch, one by one, in order. Note that
4350
any commits in `HEAD` which introduce the same textual changes as a commit

Documentation/git-reset.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
4949
'git reset' [<mode>] [<commit>]::
5050
This form resets the current branch head to `<commit>` and
5151
possibly updates the index (resetting it to the tree of `<commit>`) and
52-
the working tree depending on `<mode>`. If `<mode>` is omitted,
52+
the working tree depending on `<mode>`. Before the operation, `ORIG_HEAD`
53+
is set to the tip of the current branch. If `<mode>` is omitted,
5354
defaults to `--mixed`. The `<mode>` must be one of the following:
5455
+
5556
--

Documentation/revisions.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ characters and to avoid word splitting.
4949
`FETCH_HEAD` records the branch which you fetched from a remote repository
5050
with your last `git fetch` invocation.
5151
`ORIG_HEAD` is created by commands that move your `HEAD` in a drastic
52-
way, to record the position of the `HEAD` before their operation, so that
52+
way (`git am`, `git merge`, `git rebase`, `git reset`),
53+
to record the position of the `HEAD` before their operation, so that
5354
you can easily change the tip of the branch back to the state before you ran
5455
them.
5556
`MERGE_HEAD` records the commit(s) which you are merging into your branch

0 commit comments

Comments
 (0)