18
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gitリポジトリの総サイズを取得する方法のまとめ

Last updated at Posted at 2016-02-16

TL;DR

Gitリポジトリの総サイズを取得する方法のまとめ。

git >= 1.8.3 以上の場合

git count-objects を使用する

$ git gc
$ git count-objects -vH
実行例
$ git count-objects -vH
count: 77
size: 308.00 KiB
in-pack: 238
packs: 1
size-pack: 45.85 KiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes

git < 1.8.3 の場合

git count-objects は使用できないので git bundle create tmp.bundle --all を使用する

$ git gc
$ git bundle create tmp.bundle --all
$ du -sh tmp.bundle
実行例
$ git bundle create tmp.bundle --all
Counting objects: 314, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (131/131), done.
Writing objects: 100% (314/314), 45.90 KiB | 0 bytes/s, done.
Total 314 (delta 153), reused 314 (delta 153)

$ du -sh tmp.bundle
48K     tmp.bundle

参考

Git - git-count-objects Documentation
filesize - Find size of git repo - Stack Overflow

18
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?