git大仓库拆成若干小仓库
我们要把每个项目变成独立的git仓库,并且保留commit记录。根据1项目原始文件:MyHugeRepo/.git/DIR_A/DIR_B/DIR_C/DIR_D/首先在MyHugeRepo的父目录中执行:git clone MyHugeRepo MyHugeRepo.tmpcd MyHugeRepo.tmp得到DIR_...
我们要把每个项目变成独立的git仓库,并且保留commit记录。
根据1
项目原始文件:
MyHugeRepo/
.git/
DIR_A/
DIR_B/
DIR_C/
DIR_D/
首先在MyHugeRepo的父目录中执行: git clone MyHugeRepo MyHugeRepo.tmp cd MyHugeRepo.tmp
得到DIR_D的git仓库: git filter-branch --prune-empty --index-filter 'git rm --cached --ignore-unmatch DIR_A/* DIR_B/* DIR_C/*' HEAD cd .. 返回 MyHugeRepo.tmp的父目录 git clone MyHugeRepo.tmp DIR_D 重置refs
重复执行上述git clone等,将git filter-branch替换成下面的命令,得到DIR_C的git仓库: git filter-branch --prune-empty --index-filter 'git rm --cached --ignore-unmatch DIR_A/* DIR_B/* DIR_D/*' HEAD
依次类推
更多推荐
所有评论(0)