Skip to content

Commit ac3a91c

Browse files
committed
doc: git-rebase: start with an example
Start with an example that mirrors the example in the `git-merge` man page, to make it easier for folks to understand the difference between a rebase and a merge. Signed-off-by: Julia Evans <[email protected]>
1 parent 64cbe5e commit ac3a91c

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

Documentation/git-rebase.adoc

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ SYNOPSIS
1616

1717
DESCRIPTION
1818
-----------
19+
Transplant a series of commits onto a different starting point.
20+
21+
For example, assume the following history exists and the current branch is `topic`:
22+
23+
------------
24+
A---B---C topic
25+
/
26+
D---E---F---G master
27+
------------
28+
29+
Then `git rebase master` will find all of the commits since `topic` diverged
30+
from `master` and copy the changes in each of those commits on top of the
31+
`master` branch.
32+
33+
------------
34+
A'--B'--C' topic
35+
/
36+
D---E---F---G master
37+
------------
38+
1939
If `<branch>` is specified, `git rebase` will perform an automatic
2040
`git switch <branch>` before doing anything else. Otherwise
2141
it remains on the current branch.
@@ -58,32 +78,6 @@ that caused the merge failure with `git rebase --skip`. To check out the
5878
original `<branch>` and remove the `.git/rebase-apply` working files, use
5979
the command `git rebase --abort` instead.
6080

61-
Assume the following history exists and the current branch is "topic":
62-
63-
------------
64-
A---B---C topic
65-
/
66-
D---E---F---G master
67-
------------
68-
69-
From this point, the result of either of the following commands:
70-
71-
72-
git rebase master
73-
git rebase master topic
74-
75-
would be:
76-
77-
------------
78-
A'--B'--C' topic
79-
/
80-
D---E---F---G master
81-
------------
82-
83-
*NOTE:* The latter form is just a short-hand of `git checkout topic`
84-
followed by `git rebase master`. When rebase exits `topic` will
85-
remain the checked-out branch.
86-
8781
If the upstream branch already contains a change you have made (e.g.,
8882
because you mailed a patch which was applied upstream), then that commit
8983
will be skipped and warnings will be issued (if the 'merge' backend is

0 commit comments

Comments
 (0)