aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-rebase.txt44
-rwxr-xr-xgit-rebase.sh24
2 files changed, 56 insertions, 12 deletions
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 16c158f43..f037d1280 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -7,14 +7,54 @@ git-rebase - Rebase local commits to new upstream head.
SYNOPSIS
--------
-'git-rebase' <upstream> [<head>]
+'git-rebase' [--onto <newbase>] <upstream> [<branch>]
DESCRIPTION
-----------
-Rebases local commits to the new head of the upstream tree.
+git-rebase applies to <upstream> (or optionally to <newbase>) commits
+from <branch> that do not appear in <upstream>. When <branch> is not
+specified it defaults to the current branch (HEAD).
+
+When git-rebase is complete, <branch> will be updated to point to the
+newly created line of commit objects, so the previous line will not be
+accessible unless there are other references to it already.
+
+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 the following commands:
+
+ git-rebase master
+ git-rebase master topic
+
+would be:
+
+ A'--B'--C' topic
+ /
+ D---E---F---G master
+
+While, starting from the same point, the result of the following
+commands:
+
+ git-rebase --onto master~1 master
+ git-rebase --onto master~1 master topic
+
+would be:
+
+ A'--B'--C' topic
+ /
+ D---E---F---G master
OPTIONS
-------
+<newbase>::
+ Starting point at which to create the new commits. If the
+ --onto option is not specified, the starting point is
+ <upstream>.
+
<upstream>::
Upstream branch to compare against.
diff --git a/git-rebase.sh b/git-rebase.sh
index 21c3d83c3..211bf6896 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -4,24 +4,28 @@
#
USAGE='[--onto <newbase>] <upstream> [<branch>]'
-LONG_USAGE='If <branch> is specified, switch to that branch first. Then,
-extract commits in the current branch that are not in <upstream>,
-and reconstruct the current on top of <upstream>, discarding the original
-development history. If --onto <newbase> is specified, the history is
-reconstructed on top of <newbase>, instead of <upstream>. For example,
-while on "topic" branch:
+LONG_USAGE='git-rebase applies to <upstream> (or optionally to <newbase>) commits
+from <branch> that do not appear in <upstream>. When <branch> is not
+specified it defaults to the current branch (HEAD).
+
+When git-rebase is complete, <branch> will be updated to point to the
+newly created line of commit objects, so the previous line will not be
+accessible unless there are other references to it already.
+
+Assuming the following history:
A---B---C topic
/
D---E---F---G master
- $ '"$0"' --onto master~1 master topic
+The result of the following command:
-would rewrite the history to look like this:
+ git-rebase --onto master~1 master topic
+ would be:
- A'\''--B'\''--C'\'' topic
- /
+ A'\''--B'\''--C'\'' topic
+ /
D---E---F---G master
'