(转)解决 Git 冗余 Commit

出处:https://www.zhihu.com/question/29769130/answer/315745139

找出最大的 3 个文件:

$ git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -3

列出所有文件:

$ git rev-list –objects –all

移除引用:

$ git filter-branch –force –index-filter “git rm –cached –ignore-unmatch ‘dirs-or-files’ -flags?” –prune-empty –tag-name-filter cat — –all

Repack:

$ git for-each-ref –format=’delete %(refname)’ refs/original | git update-ref –stdin

$ git reflog expire –expire=now –all

$ git gc –prune=now

查看 pack:

$ git count-objects -v

作者: YanWen

Web 开发者

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s