Managing .git file size

前端 未结 4 1865
时光取名叫无心
时光取名叫无心 2020-12-14 12:10

My .git file has grown to 229Mb and I wondering what the best way to cut down the size is. I know about git gc and have been using it a fair amount. I\'m not totally sure

4条回答
  •  一生所求
    2020-12-14 12:36

    If you want to keep your (reachable) commit history intact, then expire, repack, prune, and garbage collect:

    git reflog expire --expire=0 --all
    git repack -ad
    git prune 
    git gc
    

    This should be the minimal size you can get your repo and keep your commit history.

    If not, i.e., you want or do not mind starting afresh with the current state of the repo as the initial commit, then Peter Tillemans' approach will do it.

提交回复
热议问题