查找Git存储库的大小 [英] Find size of Git repository

查看:209
本文介绍了查找Git存储库的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

找到Git存储库大小的简单方法是什么?

What's a simple way to find the size of my Git repository?

我的意思不是在存储库的根目录上的du -h.我有很多被忽略的文件,因此大小将与我的总存储库大小不同.我本质上想知道克隆存储库后将传输多少数据.

And I don't mean du -h on the root directory of my repository. I have a lot of ignored files, so that size would be different from my total repository size. I essentially want to know how much data would be transferred upon cloning my repository.

推荐答案

更新 git 1.8.3引入了一种更有效的方法来获取粗略的大小:git count-objects -vH(请参见@VonC的答案)

UPDATE git 1.8.3 introduced a more efficient way to get a rough size: git count-objects -vH (see answer by @VonC)

对于完整尺寸"的不同想法,您可以使用:

For different ideas of "complete size" you could use:

git bundle create tmp.bundle --all
du -sh tmp.bundle

关闭(但不完全是:)

git gc
du -sh .git/

对于后者,您还将数:

  • hooks
  • config (remotes, push branches, settings (whitespace, merge, aliases, user details etc.)
  • stashes (see Can I fetch a stash from a remote repo into a local branch? also)
  • rerere cache (which can get considerable)
  • reflogs
  • backups (from filter-branch, e.g.) and various other things (intermediate state from rebase, bisect etc.)

这篇关于查找Git存储库的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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