aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Evans <julia@jvns.ca>2025-08-23 00:42:58 +0000
committerJunio C Hamano <gitster@pobox.com>2025-08-23 09:03:28 -0700
commitf39a29c22ee5deb184517c99890bd749f2114a98 (patch)
treec04b2837dac448bbcf85fd744ffd2f6e3fb86afc
parentGit 2.50 (diff)
downloadgit-f39a29c22ee5deb184517c99890bd749f2114a98.tar.gz
git-f39a29c22ee5deb184517c99890bd749f2114a98.zip
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. - Mention that rebase can combine or reorder commits Signed-off-by: Julia Evans <julia@jvns.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--Documentation/git-rebase.adoc52
1 files changed, 26 insertions, 26 deletions
diff --git a/Documentation/git-rebase.adoc b/Documentation/git-rebase.adoc
index 956d3048f5..bb5a3ff7f8 100644
--- a/Documentation/git-rebase.adoc
+++ b/Documentation/git-rebase.adoc
@@ -16,6 +16,32 @@ SYNOPSIS
DESCRIPTION
-----------
+Transplant a series of commits onto a different starting point.
+You can also use `git rebase` to reorder or combine commits: see INTERACTIVE
+MODE below for how to do that.
+
+For example, imagine that you have been working on the `topic` branch in this
+history, and you want to "catch up" to the work done on the `master` branch.
+
+------------
+ A---B---C topic
+ /
+ D---E---F---G master
+------------
+
+You want to transplant the commits you made on `topic` since it diverged from
+`master` (i.e. A, B, and C), on top of the current `master`. You can do this
+by running `git rebase master` while the `topic` branch is checked out. If you
+want to rebase `topic` while on another branch, `git rebase master topic` is a
+shortcut for `git checkout topic && git rebase master`.
+
+------------
+ A'--B'--C' topic
+ /
+ D---E---F---G master
+------------
+
+
If `<branch>` is specified, `git rebase` will perform an automatic
`git switch <branch>` before doing anything else. Otherwise
it remains on the current branch.
@@ -58,32 +84,6 @@ that caused the merge failure with `git rebase --skip`. To check out the
original `<branch>` and remove the `.git/rebase-apply` working files, use
the command `git rebase --abort` instead.
-Assume the following history exists and the current branch is "topic":
-
-------------
- A---B---C topic
- /
- D---E---F---G master
-------------
-
-From this point, the result of either of the following commands:
-
-
- git rebase master
- git rebase master topic
-
-would be:
-
-------------
- A'--B'--C' topic
- /
- D---E---F---G master
-------------
-
-*NOTE:* The latter form is just a short-hand of `git checkout topic`
-followed by `git rebase master`. When rebase exits `topic` will
-remain the checked-out branch.
-
If the upstream branch already contains a change you have made (e.g.,
because you mailed a patch which was applied upstream), then that commit
will be skipped and warnings will be issued (if the 'merge' backend is