没有 .git 目录的 Git 克隆 [英] Git clone without .git directory
本文介绍了没有 .git 目录的 Git 克隆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在进行克隆时是否有要传递给 git
的标志,比如不要克隆 .git
目录?如果没有,克隆后删除.git
目录的标志如何?
Is there a flag to pass to git
when doing a clone, say don't clone the .git
directory? If not, how about a flag to delete the .git
directory after the clone?
推荐答案
使用
git clone --depth=1 --branch=master git://someserver/somerepo dirformynewrepo
rm -rf ./dirformynewrepo/.git
- 深度选项将确保复制尽可能少的历史记录以获取该存储库.
- 分支选项是可选的,如果未指定,将获得默认分支.
- 第二行将使您的目录
dirformynewrepo
不再是 Git 存储库. - 如果您正在执行递归子模块克隆,则深度和分支参数不适用于子模块.
- The depth option will make sure to copy the least bit of history possible to get that repo.
- The branch option is optional and if not specified would get the default branch.
- The second line will make your directory
dirformynewrepo
not a Git repository any more. - If you're doing recursive submodule clone, the depth and branch parameter don't apply to the submodules.
这篇关于没有 .git 目录的 Git 克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文