git gc

有时候当你运行一些git命令(比如git pull)的时候,会有如下提示:

1

2

Auto packing the repository for optimum performance. You may also

run "git gc" manually. See "git help gc" for more information.

  翻译:

1

2

自动包装最佳性能的存储库。

你也可以手动运行 ‘get gc’ 。有关更多信息,请参见“git帮助gc”。

当有这个提示的时候,直接运行  ' git gc ',就可以了。

原因:

Git 往磁盘保存对象时默认使用的格式叫松散对象 (loose object) 格式。Git 时不时地将这些对象打包至一个叫 packfile 的二进制文件以节省空间并提高效率。当仓库中有太多的松散对象则就会提示你运行 ' git gc '。

我们可以运行 ' find .git/objects -type f ' 命令,查看一下 objects 目录里有多少对象,如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

$ find .git/objects -type f

.git/objects/07/0cc4950ddcd2595a8134d8e560aef2a733e581

.git/objects/13/93d47387301d83214a34883f182cacb717762c

.git/objects/1c/1962af2351551af106a46a2bf43543a8bacf52

.git/objects/1c/4c0087a2c81ae4d1a521eddcecbbedc5c90270

.git/objects/36/39f696bdc97385fefb67926cdc0895e3dc5bb3

.git/objects/48/ec12b8a1a0d53d49e80156cfe969e438384da1

.git/objects/52/65597ee5edea6bc415506f097ebe072ef79363

.git/objects/52/86195cdb9c73333e06fb755272030105c50ef3

...

.git/objects/pack/pack-0c73db178d8a396a3ab624b4acf9dda479593691.idx

.git/objects/pack/pack-0c73db178d8a396a3ab624b4acf9dda479593691.pack

.git/objects/pack/pack-7c6c1af87ebb721211b490eec0ee6d5b49b5b280.idx

.git/objects/pack/pack-7c6c1af87ebb721211b490eec0ee6d5b49b5b280.pack

  然后在运行 ' git gc ' 命令后,在执行刚才的命令,看下 object 目录里面还剩下多少对象,如下:

1

2

3

4

5

6

7

8

9

10

11

12

$ git gc

Counting objects: 11099, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (3219/3219), done.

Writing objects: 100% (11099/11099), done.

Total 11099 (delta 7805), reused 10988 (delta 7712)

userName@DST56034 /D/gitProject(master)

$ find .git/objects -type f

.git/objects/info/packs

.git/objects/pack/pack-1ddf288322e0efcb6ca533b685b707ef269ff8f0.idx

.git/objects/pack/pack-1ddf288322e0efcb6ca533b685b707ef269ff8f0.pack

Auto packing the repository in background for optimum performance. See git help gc for manual hous相关推荐

  1. git长时间未清理无法拉取代码( git Auto packing the repository in background for optimum performance)

    git本地仓库,如果长时间不进行清理,几个月以后的某一天,可能拉取代码的时候突然提示你  git Auto packing the repository in background for optim ...

  2. 解决git拉取代码时报:Auto packing the repository in background for optimum performance

    问题:git本地仓库,如果长时间不进行清理,拉取代码的时候突然提示: Auto packing the repository in background for optimum performance ...

  3. Auto packing the repository in background for optimum performance.

    在idea执行git命令(比如git commit,git fetch)的时候突然提示如下: 查资料,发现原来是因为自己本地一些 "悬空对象"太多(在使用git命令删除分支或者清空 ...

  4. 解决:fatal: not a git repository (or any of the parent directories): .git的问题

    解决:fatal: not a git repository (or any of the parent directories): .git的问题 提示说没有.git这样一个目录 解决办法: 在命令 ...

  5. Git 小问题:fatal: not a git repository (or any of the parent directories): .git

    超详细 Git 图文版小白教程(持续更新) 在clone仓库到本地后,执行命令提示:fatal: not a git repository (or any of the parent director ...

  6. git报错Another git process seems to be running in this repository, e.g. an editor opened by ‘git commi

    问题: Another git process seems to be running in this repository, e.g. an editor opened by 'git commit ...

  7. ‘git’ 不是内部或外部命令,也不是可运行的程序或批处理文件;fatal: not a git repository (or any of the parent directories): .git

    一.'git' 不是内部或外部命令,也不是可运行的程序或批处理文件. cmd 里面运行git提示"不是内部或外部命令,也不是可运行的程序或批处理文件" 打开网址https://gi ...

  8. Another git process seems to be running in this repository, e.g. an editor opened by ‘git commit‘. .

    今天使用git时候报错 报错信息如下: Another git process seems to be running in this repository, e.g. an editor opene ...

  9. tortoiseGit clone大代码,报错 fatal: Not a git repository (or any of the parent directories): .git 问题

    https://blog.csdn.net/wenb1bai/article/details/89363588 规避方法 命令行中 git init git pull https://code.ali ...

最新文章

  1. 模拟浏览器的神器 - HtmlUnit
  2. java 动态读取文件_Java窗体动态加载磁盘文件的实现方法
  3. 控制显示隐藏_iOS13隐藏了5个超实用新功能:让iPhone的使用体验更好
  4. 二叉树的三叉链表实现c语言,数据结构:二叉树的三叉链表存储--Java实现
  5. 【OpenCV函数】轮廓提取;轮廓绘制;轮廓面积;外接矩形
  6. php家检乘除,php通用检测函数集(转)_php
  7. Java监听器Listener使用说明
  8. php 用什么缓存最好,在PHP中缓存中/大型数据集的一些最好的工具/策略是什么?...
  9. UVA12676 Inverting Huffman
  10. 【树莓派】使用VNC远程桌面
  11. sql还原mysql_如何还原sql数据库
  12. C++20新特性—概述
  13. 一首能记住网线水晶头接法诗
  14. JavaEE学习记录Day08、09、10
  15. 3D城市模型、实景城市图...航测无人机轻松构建另一个世界
  16. ios 页面即将消失_20个即将推出的页面介绍及如何正确处理它们
  17. 利用五次shift破解密码(Windows7)
  18. C# WPF MVVM框架搭建
  19. mysql堡垒机漏洞_关于近期网传齐治堡垒机漏洞的声明
  20. office尾注后继续插入正文

热门文章

  1. Alpha matting算法发展
  2. 小学有关计算机黑板报,计算机教室黑板报 [高中教室黑板报内容]
  3. IBM云计算平台汽车碰撞测试构建方案
  4. 标准日本语第八课课件
  5. 迷你版XP,为何不老?
  6. docker安装tomcat8并实现目录映射端口映射
  7. 当了项目经理,最想知道的八件事!
  8. Ubuntu安装 思维导图 XMind
  9. 阿里 暑期实习生面经(数字IC岗/四轮面试)
  10. 学习Python和Java哪个好?