diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-02-15 01:15:51 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-15 01:15:51 +0300 |
commit | fa5958f4d6e9f5d63b08095c454e3e5208468572 (patch) | |
tree | 7adb442b281fd3133bd6f78c9c7e6c2dab84064b /Documentation | |
parent | 4f8ab5983847fad5fa1fc5159c169243428a73d2 (diff) | |
parent | f1c9243fc5e5234ed00d3ecb71f2629c18d791ab (diff) |
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
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-cherry-pick.txt | 2 | ||||
-rw-r--r-- | Documentation/git-merge.txt | 3 | ||||
-rw-r--r-- | Documentation/git-rebase.txt | 7 | ||||
-rw-r--r-- | Documentation/git-reset.txt | 3 | ||||
-rw-r--r-- | Documentation/revisions.txt | 3 |
5 files changed, 14 insertions, 4 deletions
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index 1e8ac9df60..fdcad3d200 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -219,7 +219,7 @@ again, this time exercising more care about matching up context lines. ------------ $ git cherry-pick topic^ <1> $ git diff <2> -$ git reset --merge ORIG_HEAD <3> +$ git cherry-pick --abort <3> $ git cherry-pick -Xpatience topic^ <4> ------------ <1> apply the change that would be shown by `git show topic^`. diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 2d6a1391c8..0aeff572a5 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -37,7 +37,8 @@ Then "`git merge topic`" will replay the changes made on the `topic` branch since it diverged from `master` (i.e., `E`) until its current commit (`C`) on top of `master`, and record the result in a new commit along with the names of the two parent commits and -a log message from the user describing the changes. +a log message from the user describing the changes. Before the operation, +`ORIG_HEAD` is set to the tip of the current branch (`C`). ------------ A---B---C topic diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index f9675bd24e..d811c1cf44 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -38,6 +38,13 @@ The current branch is reset to `<upstream>` or `<newbase>` if the `git reset --hard <upstream>` (or `<newbase>`). `ORIG_HEAD` is set to point at the tip of the branch before the reset. +[NOTE] +`ORIG_HEAD` is not guaranteed to still point to the previous branch tip +at the end of the rebase if other commands that write that pseudo-ref +(e.g. `git reset`) are used during the rebase. The previous branch tip, +however, is accessible using the reflog of the current branch +(i.e. `@{1}`, see linkgit:gitrevisions[7]). + The commits that were previously saved into the temporary area are then reapplied to the current branch, one by one, in order. Note that any commits in `HEAD` which introduce the same textual changes as a commit diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt index 01cb4c9b9c..79ad5643ee 100644 --- a/Documentation/git-reset.txt +++ b/Documentation/git-reset.txt @@ -49,7 +49,8 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode. 'git reset' [<mode>] [<commit>]:: This form resets the current branch head to `<commit>` and possibly updates the index (resetting it to the tree of `<commit>`) and - the working tree depending on `<mode>`. If `<mode>` is omitted, + the working tree depending on `<mode>`. Before the operation, `ORIG_HEAD` + is set to the tip of the current branch. If `<mode>` is omitted, defaults to `--mixed`. The `<mode>` must be one of the following: + -- diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt index 0d2e55d781..9aa58052bc 100644 --- a/Documentation/revisions.txt +++ b/Documentation/revisions.txt @@ -49,7 +49,8 @@ characters and to avoid word splitting. `FETCH_HEAD` records the branch which you fetched from a remote repository with your last `git fetch` invocation. `ORIG_HEAD` is created by commands that move your `HEAD` in a drastic -way, to record the position of the `HEAD` before their operation, so that +way (`git am`, `git merge`, `git rebase`, `git reset`), +to record the position of the `HEAD` before their operation, so that you can easily change the tip of the branch back to the state before you ran them. `MERGE_HEAD` records the commit(s) which you are merging into your branch |