在压缩这两个提交之后,你将得到一个全新的提交和自 squash 以来的历史,完全称为其他东西:
* [cf0149e] (HEAD, branch_2) more editing
* [8fcc106] some edit
|
| * [59e643e] (branch_2b) branch 2b
| /
|/
| * [0f4c880] (branch_2_a) branch 2a
| /
|/
* [a74eb2a] checkout 1
* [9a8dd6a] added branch_2 line
|
| * [cf0149e'] (HEAD', branch_2') more editing (post-squash rebase)
| * [8fcc106'] some edit (post-squash rebase)
| * [SQUASHED] "checkout 1" + "added branch_2 line"
|/
|
| * [bb903de] (branch_3) branch 3
|/
|
| * [674e08c] (branch_1) commit 1
| * [7d3db01] added branch_1 line
|/
* [328454f] (0.0.0) test
请注意,其他现存的分支不受影响;那是因为你所做的只是做了一个新的压缩提交——它不会改变其他任何东西的历史。
你的 HEAD 现在指向cf0149e'
,它将有一个新的 SHA1 哈希,因为你已经改变了它的历史。
现在,您可以rebase
将其他分支一个接一个, on SQUASHED
,因为那是它们分支的点,以生成:
* [cf0149e] (HEAD, branch_2) more editing
* [8fcc106] some edit
|
| * [59e643e] (branch_2b) branch 2b
| /
|/
| * [0f4c880] (branch_2_a) branch 2a
| /
|/
* [a74eb2a] checkout 1
* [9a8dd6a] added branch_2 line
|
| * [cf0149e'] (HEAD', branch_2') more editing (post-squash rebase)
| * [8fcc106'] some edit (post-squash rebase)
| |
| | * [59e643e] (branch_2b') branch 2b (rebased on SQUASHED)
| | /
| |/
| | * [0f4c880'] (branch_2_a') branch 2a (rebased on SQUASHED)
| | /
| |/
| * [SQUASHED] "checkout 1" + "added branch_2 line"
|/
|
| * [bb903de] (branch_3) branch 3
|/
|
| * [674e08c] (branch_1) commit 1
| * [7d3db01] added branch_1 line
|/
* [328454f] (0.0.0) test
旧的历史现在已经无关紧要了,所以我们真的有:
* [cf0149e'] (HEAD', branch_2') more editing (post-squash rebase)
* [8fcc106'] some edit (post-squash rebase)
|
| * [59e643e] (branch_2b') branch 2b (rebased on SQUASHED)
| /
|/
| * [0f4c880'] (branch_2_a') branch 2a (rebased on SQUASHED)
| /
|/
* [SQUASHED] "checkout 1" + "added branch_2 line"
|
| * [bb903de] (branch_3) branch 3
|/
|
| * [674e08c] (branch_1) commit 1
| * [7d3db01] added branch_1 line
|/
* [328454f] (0.0.0) test