gpt4 book ai didi

git - 使用 --depth 1 克隆后使用 git pull 更新

转载 作者:IT王子 更新时间:2023-10-29 01:01:11 32 4
gpt4 key购买 nike

今天早上我做了一个 Linux 源代码的浅克隆

git clone --depth 1 https://github.com/torvalds/linux.git

这导致了一个 851Mb 的 linux 文件夹。

现在我想提取最新的更改,但是

git pull

开始一个看似巨大的下载。在 60Mb 之后,我处于 ​​3%,这可以推断为 2Gb。然而,自从我的克隆以来的 5 次提交只更改了一堆行。

我做错了什么吗? git 尝试下载的 2Gb 是多少?

最佳答案

我认为您也可以在 git pull 中使用 --depth 1,这样它就可以获取存储库中最新提交所需的内容。

我不知道默认行为是否是 pull 所有丢失的东西,因为我的 git help pull 显示了这个选项:

git pull --unshallow

git fetch  --unshallow

--unshallow Convert a shallow repository to a complete one, removing all the limitations imposed by shallow repositories.

我正在运行 git version 1.8.5.2 (Apple Git-48),也许这是某种新行为,并且在不同版本之间发生了一些变化。

关于git - 使用 --depth 1 克隆后使用 git pull 更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23986685/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com