之后如何获得完整的git历史记录"git clone --depth = 1"? [英] How to get whole git history afterwards "git clone --depth=1"?

查看:728
本文介绍了之后如何获得完整的git历史记录"git clone --depth = 1"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个git仓库很大,其中包含以前提交的大量资产.

One of my git repo was huge, containing huge assets to previous commits.

以某种方式,我能够使用git clone <repo> --depth=1克隆repo(可运行).

Somehow I was able to clone repo(made runnable) using git clone <repo> --depth=1.

我想在同一本地存储库上获得所有先前的提交.

I want to get all the previous commits on same local repo.

谢谢.

推荐答案

git pull --unshallow应该这样做.

发自( git-scm )

--unshallow

如果源存储库已完成,请将浅存储库转换为完整存储库,从而消除浅存储库带来的所有限制.

If the source repository is complete, convert a shallow repository to a >complete one, removing all the limitations imposed by shallow repositories.

如果源存储库较浅,请尽可能多地获取,以使当前存储库与源存储库具有相同的历史记录.

If the source repository is shallow, fetch as much as possible so that the >current repository has the same history as the source repository.

pull--depth--deepen=--shallow-since也可能是相关的.

pull's --depth, --deepen= and --shallow-since may also be relevant.

发自( git-scm )

--depth=<depth>

将限制从每个远程分支历史记录的顶端提取到指定的提交数量.如果使用--depth =选项获取由git clone创建的浅层存储库(请参见git-clone [1]),则将历史记录加深或缩短到指定的提交次数.无法获取用于深化的提交的标签.

Limit fetching to the specified number of commits from the tip of each remote branch history. If fetching to a shallow repository created by git clone with --depth= option (see git-clone[1]), deepen or shorten the history to the specified number of commits. Tags for the deepened commits are not fetched.

--deepen=<depth>

类似于--depth,不同之处在于它指定了从当前浅边界(而不是从每个远程分支历史记录的尖端)提交的次数.

Similar to --depth, except it specifies the number of commits from the >current shallow boundary instead of from the tip of each remote branch history.

--shallow-since=<date>

加深或缩短浅存储库的历史记录,以包括<date>之后的所有可到达的提交.

Deepen or shorten the history of a shallow repository to include all reachable commits after <date>.


git大师@torek指出以下内容:


git guru @torek points out the following:

请注意,默认情况下,使用--depth创建的克隆也是单分支克隆.要使其成为完整的克隆,您将需要撤消此单个分支效果.

Be aware that a clone made with --depth is also, by default, a single-branch clone. To make it a full clone you will need to undo this single branch effect.

如何执行操作显示在如何撤消" ; -单分支克隆?.

这篇关于之后如何获得完整的git历史记录"git clone --depth = 1"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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