找到我的git存储库大小的简单方法是什么?而且我不是指du -h我的仓库的根目录.我有很多被忽略的文件,因此大小与我的总回购大小不同.我基本上想知道在克隆我的回购时会传输多少数据.
seh*_*ehe 246
UPDATE git 1.8.3引入了一种更有效的方法来获得粗略的大小:(
git count-objects -vH见@VonC的回答)
对于"完整尺寸"的不同想法,您可以使用:
git bundle create tmp.bundle --all
du -sh tmp.bundle
Run Code Online (Sandbox Code Playgroud)
关闭(但不完全:)
git gc
du -sh .git/
Run Code Online (Sandbox Code Playgroud)
对于后者,你也会指望:
Von*_*onC 234
请注意,自git 1.8.3(2013年4月22日):
"
git count-objects"学会"--human-readable"又名"-H"选项显示各种大数字Ki/Mi/GiB必要时缩放.
git gc
git count-objects -vH
Run Code Online (Sandbox Code Playgroud)
加(仍然是git 1.8.3),输出更完整:
"
git count-objects -v"学会了在对象库中报告剩余的临时包文件和其他垃圾.
Jac*_*son 107
git命令
git count-objects -v
Run Code Online (Sandbox Code Playgroud)
将为您提供git存储库大小的良好估计.如果没有-v标志,它只会告诉您解压缩文件的大小.这个命令可能不在你的$ PATH中,你可能需要跟踪它(在Ubuntu上我发现它在/ usr/lib/git-core /中).
从Git手册页:
-v, - verbose
除了消耗的松散对象和磁盘空间的数量之外,它还报告包内对象的数量,包的数量,这些包消耗的磁盘空间以及通过运行git prune-packed可以删除的对象的数量.
您的输出将类似于以下内容:
count: 1910
size: 19764
in-pack: 41814
packs: 3
size-pack: 1066963
prune-packable: 1
garbage: 0
Run Code Online (Sandbox Code Playgroud)
你要找的那条线是size-pack.这是所有打包的提交对象的大小,或者是新克隆的存储库的最小可能大小.
ser*_*inc 12
你可以使用git-sizer. 在--verbose设置中,示例输出是(如下)。寻找Total size of files线路。
Run Code Online (Sandbox Code Playgroud)$ git-sizer --verbose Processing blobs: 1652370 Processing trees: 3396199 Processing commits: 722647 Matching commits to trees: 722647 Processing annotated tags: 534 Processing references: 539 | Name | Value | Level of concern | | ---------------------------- | --------- | ------------------------------ | | Overall repository size | | | | * Commits | | | | * Count | 723 k | * | | * Total size | 525 MiB | ** | | * Trees | | | | * Count | 3.40 M | ** | | * Total size | 9.00 GiB | **** | | * Total tree entries | 264 M | ***** | | * Blobs | | | | * Count | 1.65 M | * | | * Total size | 55.8 GiB | ***** | | * Annotated tags | | | | * Count | 534 | | | * References | | | | * Count | 539 | | | | | | | Biggest objects | | | | * Commits | | | | * Maximum size [1] | 72.7 KiB | * | | * Maximum parents [2] | 66 | ****** | | * Trees | | | | * Maximum entries [3] | 1.68 k | * | | * Blobs | | | | * Maximum size [4] | 13.5 MiB | * | | | | | | History structure | | | | * Maximum history depth | 136 k | | | * Maximum tag depth [5] | 1 | | | | | | | Biggest checkouts | | | | * Number of directories [6] | 4.38 k | ** | | * Maximum path depth [7] | 13 | * | | * Maximum path length [8] | 134 B | * | | * Number of files [9] | 62.3 k | * | | * Total size of files [9] | 747 MiB | | | * Number of symlinks [10] | 40 | | | * Number of submodules | 0 | | [1] 91cc53b0c78596a73fa708cceb7313e7168bb146 [2] 2cde51fbd0f310c8a2c5f977e665c0ac3945b46d [3] 4f86eed5893207aca2c2da86b35b38f2e1ec1fc8 (refs/heads/master:arch/arm/boot/dts) [4] a02b6794337286bc12c907c33d5d75537c240bd0 (refs/heads/master:drivers/gpu/drm/amd/include/asic_reg/vega10/NBIO/nbio_6_1_sh_mask.h) [5] 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c (refs/tags/v2.6.11) [6] 1459754b9d9acc2ffac8525bed6691e15913c6e2 (589b754df3f37ca0a1f96fccde7f91c59266f38a^{tree}) [7] 78a269635e76ed927e17d7883f2d90313570fdbc (dae09011115133666e47c35673c0564b0a702db7^{tree}) [8] ce5f2e31d3bdc1186041fdfd27a5ac96e728f2c5 (refs/heads/master^{tree}) [9] 532bdadc08402b7a72a4b45a2e02e5c710b7d626 (e9ef1fe312b533592e39cddc1327463c30b0ed8d^{tree}) [10] f29a5ea76884ac37e1197bef1941f62fda3f7b99 (f5308d1b83eba20e69df5e0926ba7257c8dd9074^{tree})
| 归档时间: |
|
| 查看次数: |
113840 次 |
| 最近记录: |