How to deal with the problem that the local github warehouse .git directory is too large under the WIN platform?

see that Zhihu introduced a method above:

author: Zheng Yu
link: https://www.zhihu.com/questio.
Source: Zhihu
copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.

you can try to delete the large files inside. The following is the specific method of operation: 1. Run gc to generate the pack file (the following-- prune=now means to prune all previous submissions, sometimes the .git file will be much smaller just by gc) $git gc-- prune=now

  1. find the three largest files (see what you need) $git verify-pack-v. git / objects/pack/*.idx | sort-k 3-n | tail-3
< H1 > sample output: < / H1 > < H1 > 1debc758cf31a649c2fc5b0c59ea1b7f01416636 blob 4925660 3655422 14351 < / H1 > < H1 > c43a8da9476f97e84b52e0b34034f8c2d93b4d90 blob 154188651 152549294 12546842 < / H1 > < H1 > 2272096493d061489349e0a312df00dcd0ec19a2 blob 155414465 153754005 165096136 < / H1 >
  1. check who those large files are (c43a8da is the hash code of the large file above) $git rev-list-- objects-- all | grep c43a8da
< H1 > c43a8da9476f97e84b52e0b34034f8c2d93b4d90 data/bigfile < / H1 >

4. Remove the reference to the file (that is, data/bigfile) $git filter-branch-- force-- index-filter "git rm-- cached-- ignore-unmatch "data/bigfile""-- prune-empty-- tag-name-filter cat-all
5. Repack $git for-each-ref-- format="delete% (refname) "refs/original | git update-ref-- stdin
$git reflog expire-- expire=now-- all
$git gc-- prune=now
6. Check the space usage of pack $git count-objects-v

ran Goose, this is WIN7.. It"s just a cmder. How should it be done?

Mar.07,2021
Menu