赞
踩
git submodule
or
git subtree
cd 项目A
git subtree split -P LibraryC -b tempLibraryC (把libraryC抽离为tempLibraryC)
cd ../
mkdir tempDir
cd tempDir
git init
git pull ../项目A tempLibraryC
git remote add origin git@192.168.1.123:rep/libraryC.git
git push origin -u master
git filter-branch -f --index-filter "git rm -r -f -q --cached --ignore-unmatch LibraryC" --prune-empty HEAD //清理掉原来的commit记录
cd 项目B
git remote add libraryc git@192.168.1.123:rep/libraryC.git //添加源
git subtree add --prefix LibraryC libraryc master //后三个参数分别是:目录、源名称、分支名
git subtree pull --prefix LibraryC libraryc master //更新代码
git subtree push --prefix LibraryC libraryc master //提交代码
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。