Skip to content

Commit 82b3419

Browse files
committed
doc: git-rebase: update discussion of internals
- make it clearer that we're talking about three steps of a process - delete a duplicate explanation of how git rebase skips commits with the same textual changes (it's explained in more detail a few lines further down) - move the `ORIG_HEAD` note down so that it doesn't interrupt the discussion of the mechanics.
1 parent 0b3f224 commit 82b3419

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Documentation/git-rebase.adoc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,30 @@ linkgit:git-config[1] for details) and the `--fork-point` option is
6767
assumed. If you are currently not on any branch or if the current
6868
branch does not have a configured upstream, the rebase will abort.
6969

70-
All changes made by commits in the current branch but that are not
70+
Here is a more detailed description of what `git rebase <upstream>` does:
71+
72+
First, all changes made by commits in the current branch but that are not
7173
in `<upstream>` are saved to a temporary area. This is the same set
7274
of commits that would be shown by `git log <upstream>..HEAD`; or by
7375
`git log 'fork_point'..HEAD`, if `--fork-point` is active (see the
7476
description on `--fork-point` below); or by `git log HEAD`, if the
7577
`--root` option is specified.
7678

77-
The current branch is reset to `<upstream>` or `<newbase>` if the
79+
Then the current branch is reset to `<upstream>` or `<newbase>` if the
7880
`--onto` option was supplied. This has the exact same effect as
7981
`git reset --hard <upstream>` (or `<newbase>`). `ORIG_HEAD` is set
8082
to point at the tip of the branch before the reset.
8183

84+
Then the commits that were previously saved into the temporary area are
85+
reapplied to the current branch, one by one, in order.
86+
8287
[NOTE]
8388
`ORIG_HEAD` is not guaranteed to still point to the previous branch tip
8489
at the end of the rebase if other commands that write that pseudo-ref
8590
(e.g. `git reset`) are used during the rebase. The previous branch tip,
8691
however, is accessible using the reflog of the current branch
8792
(i.e. `@{1}`, see linkgit:gitrevisions[7]).
8893

89-
The commits that were previously saved into the temporary area are
90-
then reapplied to the current branch, one by one, in order. Note that
91-
any commits in `HEAD` which introduce the same textual changes as a commit
92-
in `HEAD..<upstream>` are omitted (i.e., a patch already accepted upstream
93-
with a different commit message or timestamp will be skipped).
94-
9594
If the upstream branch already contains a change you have made (e.g.,
9695
because you mailed a patch which was applied upstream), then that commit
9796
will be skipped and warnings will be issued (if the 'merge' backend is

0 commit comments

Comments
 (0)