diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-06-21 06:02:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-06-21 06:02:47 -0700 |
commit | d4f8f74bc6cf8c5851f67d46c49b6e2c8fea601b (patch) | |
tree | 7a86c027c772b0670302218ff6ccea60a8835e87 | |
parent | Merge branch 'tc/commit-abbrev-fix' (diff) | |
parent | rebase -i -p: document shortcomings (diff) | |
download | tgif-d4f8f74bc6cf8c5851f67d46c49b6e2c8fea601b.tar.xz |
Merge branch 'jn/document-rebase-i-p-limitation'
* jn/document-rebase-i-p-limitation:
rebase -i -p: document shortcomings
-rw-r--r-- | Documentation/git-rebase.txt | 27 | ||||
-rwxr-xr-x | t/t3404-rebase-interactive.sh | 6 |
2 files changed, 33 insertions, 0 deletions
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 50ba2e469f..be23ad2359 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -310,6 +310,11 @@ link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for details). -p:: --preserve-merges:: Instead of ignoring merges, try to recreate them. ++ +This uses the `--interactive` machinery internally, but combining it +with the `--interactive` option explicitly is generally not a good +idea unless you know what you are doing (see BUGS below). + --root:: Rebase all commits reachable from <branch>, instead of @@ -611,6 +616,28 @@ The ripple effect of a "hard case" recovery is especially bad: case" recovery too! +BUGS +---- +The todo list presented by `--preserve-merges --interactive` does not +represent the topology of the revision graph. Editing commits and +rewording their commit messages should work fine, but attempts to +reorder commits tend to produce counterintuitive results. + +For example, an attempt to rearrange +------------ +1 --- 2 --- 3 --- 4 --- 5 +------------ +to +------------ +1 --- 2 --- 4 --- 3 --- 5 +------------ +by moving the "pick 4" line will result in the following history: +------------ + 3 + / +1 --- 2 --- 4 --- 5 +------------ + Authors ------ Written by Junio C Hamano <gitster@pobox.com> and diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index f20ea38411..6668907ec5 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -181,6 +181,12 @@ test_expect_success '-p handles "no changes" gracefully' ' test $HEAD = $(git rev-parse HEAD) ' +test_expect_failure 'exchange two commits with -p' ' + FAKE_LINES="2 1" git rebase -i -p HEAD~2 && + test H = $(git cat-file commit HEAD^ | sed -ne \$p) && + test G = $(git cat-file commit HEAD | sed -ne \$p) +' + test_expect_success 'preserve merges with -p' ' git checkout -b to-be-preserved master^ && : > unrelated-file && |