summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <Johannes.Schindelin@gmx.de>2007-06-25 18:59:43 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2007-06-26 18:58:59 -0700
commitf09c9b8c5ff9d8a15499b09ccd6c3e7b3c76af77 (patch)
tree39662b301bd6abe55717934d567f72cd9b54dea7 /Documentation
parentrebase -i: provide reasonable reflog for the rebased branch (diff)
downloadtgif-f09c9b8c5ff9d8a15499b09ccd6c3e7b3c76af77.tar.xz
Teach rebase -i about --preserve-merges
The option "-p" (or long "--preserve-merges") makes it possible to rebase side branches including merges, without straightening the history. Example: X \ A---M---B / ---o---O---P---Q When the current HEAD is "B", "git rebase -i -p --onto Q O" will yield X \ ---o---O---P---Q---A'---M'---B' Note that this will - _not_ touch X [*1*], it does - _not_ work without the --interactive flag [*2*], it does - _not_ guess the type of the merge, but blindly uses recursive or whatever strategy you provided with "-s <strategy>" for all merges it has to redo, and it does - _not_ make use of the original merge commit via git-rerere. *1*: only commits which reach a merge base between <upstream> and HEAD are reapplied. The others are kept as-are. *2*: git-rebase without --interactive is inherently patch based (at least at the moment), and therefore merges cannot be preserved. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-rebase.txt23
1 files changed, 22 insertions, 1 deletions
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 2e3363a617..96907d4863 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git-rebase' [-i | --interactive] [-v | --verbose] [--merge] [-C<n>]
- [--onto <newbase>] <upstream> [<branch>]
+ [-p | --preserve-merges] [--onto <newbase>] <upstream> [<branch>]
'git-rebase' --continue | --skip | --abort
DESCRIPTION
@@ -213,6 +213,10 @@ OPTIONS
Make a list of the commits which are about to be rebased. Let the
user edit that list before rebasing.
+-p, \--preserve-merges::
+ Instead of ignoring merges, try to recreate them. This option
+ only works in interactive mode.
+
include::merge-strategies.txt[]
NOTES
@@ -304,6 +308,23 @@ $ git rebase -i HEAD~5
And move the first patch to the end of the list.
+You might want to preserve merges, if you have a history like this:
+
+------------------
+ X
+ \
+ A---M---B
+ /
+---o---O---P---Q
+------------------
+
+Suppose you want to rebase the side branch starting at "A" to "Q". Make
+sure that the current HEAD is "B", and call
+
+-----------------------------
+$ git rebase -i -p --onto Q O
+-----------------------------
+
Authors
------
Written by Junio C Hamano <junkio@cox.net> and