相关疑难解决方法(0)

如何从浅层克隆中有效地获取git

我们使用git来分发操作系统并使其保持最新状态.我们无法分发完整的存储库,因为它太大(> 2GB),所以我们一直在使用浅克隆(~300M).然而,最近从浅层克隆中获取时,它现在无法有效地获取整个> 2GB存储库.这对于部署而言是无法浪费的带宽浪费.

git文档说你无法从浅存储库中获取,尽管这绝对不是真的.是否有任何变通方法git clone --depth 1可以获取它的变化?或者其他一些策略是保持分布大小尽可能小,同时让git需要进行更新所有位?

我没有成功尝试克隆--depth 20,看它是否会更有效地升级,这是行不通的.我也看了http://git-scm.com/docs/git-bundle,但这似乎创造了巨大的捆绑.

git github shallow-clone

46
推荐指数
4
解决办法
3万
查看次数

为什么我不能从浅层克隆中推出?

git clone --depth命令选项说

--depth <depth> 
Create a shallow clone with a history truncated to the specified number of revisions. 
A shallow repository has a number of limitations 
(you cannot clone or fetch from it, nor push from nor into it),
 but is adequate if you are only interested in the recent history of a large project with a long history,
 and would want to send in fixes as patches. 
Run Code Online (Sandbox Code Playgroud)

为什么浅克隆有这种限制?为什么它只是一个补丁工作流程?

对于某些项目工作流程,我需要将最新的提交从单个分支传递给编码器,然后让它们能够push(快进)开发到主服务器.这部分是为了安全,知识产权保护和回购规模,部分是为了减少大回购会给天真编码员带来的困惑.是否有允许这样的git工作流程?


更新:根据Karl Bielefeldt的回答,git checkout --orphan …

git workflow git-clone

45
推荐指数
2
解决办法
3万
查看次数

标签 统计

git ×2

git-clone ×1

github ×1

shallow-clone ×1

workflow ×1