Skip to content

Commit 96fc817

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 353662b commit 96fc817

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Documentation/git-rebase.adoc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ history, and you want to "catch up" to the work done on the `master` branch.
3030
You want to transplant the commits you made on `topic` since it diverged from
3131
`master` (i.e. A, B, and C), on top of the current `master`. You can do this
3232
by running `git rebase master` while the `topic` branch is checked out. If you
33-
want to rebase `topic` while on a different branch, `git rebase master topic` is a
33+
want to rebase `topic` while on another branch, `git rebase master topic` is a
3434
short-cut for `git switch topic && git rebase master`.
3535

3636
------------
@@ -68,31 +68,30 @@ linkgit:git-config[1] for details) and the `--fork-point` option is
6868
assumed. If you are currently not on any branch or if the current
6969
branch does not have a configured upstream, the rebase will abort.
7070

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

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

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

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

0 commit comments

Comments
 (0)