给定包含文件的git存储库A:
A/a.1.txt并提交历史记录:
A3333333333
A2222222222
A1111111111和包含文件的git存储库B:
B/a.1.txt并提交历史记录
B3333333333
B2222222222
B1111111111我希望将存储库B作为子目录导入到存储库A中,并将其所有历史记录分组到A的历史记录之后,以便它具有文件
A/a.1.txt
A/B/a.1.txt并提交历史记录:
B3333333333
B2222222222
B1111111111
A3333333333
A2222222222
A1111111111发布于 2016-05-25 06:18:55
如下所示:
# register the remote of the other repo
git remote add -f other url-to-repo
# merge the content from `other`
git merge -s ours --no-commit other/master
# read the content under the directory PREFIX
#git read-tree --prefix=somedir -u other/master
git read-tree --prefix=A -u other/master
# commit the merge
git commit -m "subtree merge"提交历史记录不会像您要求的那样是100%,因为另一个分支将被合并,所以在最后会有一个合并提交,历史记录看起来更像这样:
* 938762e (HEAD -> append) subtree merge
|\
| * B3333333333
| * B2222222222
| * B1111111111
* A3333333333
* A2222222222
* A1111111111发布于 2016-05-25 06:15:03
https://stackoverflow.com/questions/37424247
复制相似问题