Skip to content

Commit ad97cd9

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. Signed-off-by: Julia Evans <[email protected]>
1 parent 590d748 commit ad97cd9

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
@@ -65,31 +65,30 @@ linkgit:git-config[1] for details) and the `--fork-point` option is
6565
assumed. If you are currently not on any branch or if the current
6666
branch does not have a configured upstream, the rebase will abort.
6767

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

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

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

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

0 commit comments

Comments
 (0)