用--depth 1克隆后用git拉动更新 [英] Pull updates with git after cloned with --depth 1

查看:1209
本文介绍了用--depth 1克隆后用git拉动更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

导致 linux 851Mb的文件夹。



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

  git pull 

开始一个非常巨大的下载。 60Mb后,我在3%,推断2Gb。然而,5次提交是因为我的克隆只改变了一堆行。



我做错了什么?什么是2Gb, git 试图下载?

解决方案

你也可以在 git pull 中使用 - depth 1 ,这样它就得到了最新的commit



我不知道默认行为是否会导致缺失,因为我的 git help pull 显示此选项:

  git pull --unshallow 

  git fetch --unshallow 

$ block $ $

将一个浅仓库转换为一个完整的仓库,浅的仓库。

我正在运行 git version 1.8.5.2(Apple Git-48),也许这是一种新的行为,并在版本之间稍微改变一些。


This morning I made a shallow clone of the Linux sources

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

which resulted in a linux folder of 851Mb.

Now I would like to pull the latest changes, but

git pull

starts a seemly huge download. After 60Mb I'm at 3% which extrapolates to 2Gb. However, the 5 commits since my clone change only a bunch of lines.

Am I doing something wrong? What are the 2Gb that git tries to download?

解决方案

I think you can use --depth 1 in git pull too, so it gets just what's needed for the newest commit in the repository.

I don't know if the default behaviour is to pull everything missing, because my git help pull shows this option:

git pull --unshallow

or

git fetch  --unshallow

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

I'm running git version 1.8.5.2 (Apple Git-48), and maybe this is some sort-of-new behaviour, and changing a bit between versions.

这篇关于用--depth 1克隆后用git拉动更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆