序号 | 录入时间 | 录入人 | 备注 |
---|---|---|---|
1 | 2016-07-21 | Alfred Jiang | - |
Git - 如何 clone git 项目到一个非空目录
Git \ clone git 非空目录
- 对一个主工程的子工程进行单独的 Git 管理时
如果我们往一个非空的目录下 clone git 项目,就会提示错误信息:
fatal: destination path '.' already exists and is not an empty directory.
解决的办法是:
- 进入非空目录,假设是 /workdir/proj1
- 执行以下命令
git clone --no-checkout https://git.oschina.net/NextApp/platform.git tmp
mv tmp/.git . #将 tmp 目录下的 .git 目录移到当前目录
rmdir tmp
git reset --hard HEAD
然后就可以进行各种正常操作了。
(无)
(无)