没有.git目录的Git克隆 [英] Git clone without .git directory
本文介绍了没有.git目录的Git克隆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
如何做一个git export (比如svn export)
是否有一个标志传递给 git
做一个克隆时,比如说不克隆 .git
目录?如果没有,那么在克隆后删除 .git
目录的标志怎么样?
解决方案<使用使用
git clone --depth = 1 --branch = master git:// someserver / somerepo dirformynewrepo
rm -rf!$ / .git
- 深度选项将确保复制尽可能少的历史记录以获取该回购。
- 分支选项是可选的,如果未指定,则会获得主数据。
- 第二行将使您的目录
dirformynewrepo
不再是Git存储库。 - 如果您正在执行递归子模块克隆,深度和分支参数不适用于子模块。
Possible Duplicate:
How to do a “git export” (like “svn export”)
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?
解决方案
Use
git clone --depth=1 --branch=master git://someserver/somerepo dirformynewrepo
rm -rf !$/.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 master.
- 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屋!
查看全文