【发布时间】:2014-01-12 12:02:53
【问题描述】:
我有一个包含 2 个目录和多个分支的 git repo,我想拆分它们并创建所有分支
`-- Big-repo
|-- dir1
`-- dir2
Branches : branch1, branch2, branch3 ...
我想要什么
我想将 dir1 和 dir2 拆分为两个单独的存储库,并在两个存储库中保留分支 branch1、branch2 ...。
dir1
Branches : branch1, branch2, branch3 ...
dir2
Branches : branch1, branch2, branch3 ...
我尝试了什么:
我可以使用
将它们分成 2 个存储库git subtree split -P dir1 -b dir1-only
git subtree split -P dir2 -b dir2-only
但是,分离后并没有创建任何分支。
获取所有分支:
git checkout branch1 (in Big-repo)
git subtree split -p dir1 -b dir1-branch1
git checkout branch2 (in Big-repo)
git subtree split -p dir1 -b dir1-branch2
And push these branches to newly created repo.
这需要更多的手动工作,我相信可能有一种快速的方法来实现这一点?
有什么想法吗???
【问题讨论】:
标签: git git-submodules git-subtree git-filter-branch