git subtree split
将
.
假设原始git repo文件结构如下:
Root
|___ file1
|___ file2
|___ subfolder/
|___ file3
|___ file4
原始提交历史记录为:
* 8cb09fb (HEAD -> master) Merge branch 'dev' into matser
|\
| * e1e054c (dev) change file2 for fourth time merge
* | 6e8ee57 change file3 for fourth time merge
* | ebdfb0b Merge branch 'dev' into master
|\ \
| |/
| * 5d93766 change file2 for thrid time merge
* | b95668a change file1 for thrid time merge
* | 09ca222 Merge branch 'dev' into matser
|\ \
| |/
| * d3dc890 change file3 for second time merge
* | 5818123 change file1 for second time merge
* | cb39f04 Merge branch 'dev' into master
|\ \
| |/
| * 4dc4aaa change file3 and file4 on dev branch
* | fef775c change file3 and file4 on master branch
|/
* d8d81e6 add subfolder and itâs files
* 5446ea3 change file1
如果您使用
拆分
subfolder
子文件夹
(
file3
file4
)将显示在新的回购提交历史记录中。新回购提交历史如下:
* 60a7f3e (master) change file3 for fourth time merge
* 954b730 Merge branch 'dev' into master
|\
| * b4b8d92 change file3 for second time merge
* | 35f7754 Merge branch 'dev' into matser
|\ \
| |/
| * fde1de3 change file3 and file4 on master branch
* | d4795a8 change file3 and file4 on master branch
|/
* cd367a2 add subfolder and itâs files
-
对于第一次提交
5446ea
,它只改变了
file1
(共个)
-
对于提交
5818123
需要第二次合并,因为它也只发生了更改
,新回购中不会显示承诺。
-
对于提交(
b95668a
5d93766
和
ebdfb0b
)对于第三次合并,它们都没有更改
子文件夹
,因此它们不会出现在新的回购协议中。
-
e1e054c
,它只改变了
file2
在…上
dev
-
对于第四次合并提交
8cb09fb
子文件夹
(
文件4
)与第一个父提交相同的版本
6e8ee57
master