gitで重いファイルを削除

gitで重いファイル削除
http://qiita.com/go_astrayer/items/6e39d3ab16ae8094496c
http://dskd.jp/archives/46.html
http://www.d-wood.com/blog/2014/10/03_6965.html 

まずサイズを確認

git count-objects -v
warning: garbage found: .git/objects/pack/tmp_pack_EZHfr8
count: 59
size: 292
in-pack: 1281
packs: 2
size-pack: 2178480
prune-packable: 0
garbage: 1
size-garbage: 277136

保全作業

git gc

もっかい確認 size-packは減っていない。

git count-objects -v
count: 0
size: 0
in-pack: 1339
packs: 1
size-pack: 2178513
prune-packable: 0
garbage: 0
size-garbage: 0


公式から git_find_big.sh
Maintaining a Git Repository – Bitbucket – Atlassian Documentation

All sizes are in kB's. The pack column is the size of the object, compressed, inside the pack file.
87c7d20c9f23c82658b315e13875d7d27384a0b4 blob 2058260480 1347249558 8616323 308c3c70c2595bcf39ab660e21212e4cec437552 blob 2039977544 591847927 1528641509 4f67f3725dabf59a6189cfbcff930879cf2fa10e blob 283573990 85479193 1390549993 168a9518d0d23b71fb093ffa560b7e964b2c3d78 blob 269219173 95524608 2126371577 ecfcd6e745bfc04f586fbe407aaa8ffc6a345ebf blob 81141999 23441047 1476037605 674a0b14f530c06bd68c01704ea233d5a0d2f0df blob 35420501 348164 1528293345 e782bb5fb7b0c2ef1a8cb3df91a636f41411f1b9 blob 27813481 23903254 1360832910 dd765b4b106a33b3dc8eb6ffe8bc73b1226c2e99 blob 22036561 5506224 1384764906 c79ce39a0247577c1eda3f8c8c857efb1db700c8 blob 20824886 18068182 1510224500 bb481768ada3997a09a9b7bb15ae2ed602cb051c blob 17559208 7414929 1502809044 1 4f67f3725dabf59a6189cfbcff930879cf2fa10e
size pack SHA location
2010020 1315673 87c7d20c9f23c82658b315e13875d7d27384a0b4 base_example.sqlite3
1992165 577976 308c3c70c2595bcf39ab660e21212e4cec437552 update/tmp_R
276927 83475 4f67f3725dabf59a6189cfbcff930879cf2fa10e update/tmp_R
262909 93285 168a9518d0d23b71fb093ffa560b7e964b2c3d78 update/nohup.out
79240 22891 ecfcd6e745bfc04f586fbe407aaa8ffc6a345ebf update/tmp_R
34590 340 674a0b14f530c06bd68c01704ea233d5a0d2f0df update/tmp123
27161 23343 e782bb5fb7b0c2ef1a8cb3df91a636f41411f1b9 update/Rplots.pdf
21520 5377 dd765b4b106a33b3dc8eb6ffe8bc73b1226c2e99 update/tmp_R
20336 17644 c79ce39a0247577c1eda3f8c8c857efb1db700c8 update/Rplots.pdf
17147 7241 bb481768ada3997a09a9b7bb15ae2ed602cb051c update/tmp_R

消す git filter-branch で過去履歴を含めて消す

1054 2016-01-22 21:07:46 git filter-branch -f --index-filter 'git rm --ignore-unmatch base_example.sqlite3'
1055 2016-01-22 21:08:19 git filter-branch -f --index-filter 'git rm --ignore-unmatch update/tmp_R'
1056 2016-01-22 21:08:49 git filter-branch -f --index-filter 'git rm --ignore-unmatch update/nohup.out'
1057 2016-01-22 21:09:26 git filter-branch -f --index-filter 'git rm --ignore-unmatch update/Rplots.pdf'
1058 2016-01-22 21:09:55 git filter-branch -f --index-filter 'git rm --ignore-unmatch update/tmp123'
1061 2016-01-22 21:10:54 git commit -m "remove the update file"

git push する

1064 2016-01-22 21:13:31 git push -f
<<