Think before you speak, read before you think.

git 清理 dangle objects

by

in

经常 commit –amend,merge,rebase,reset –hard 后,会产生一些没有引用的 objects,这些有的可能会恢复你误操作后的修改,但是大部分时间是没用的。想着清理一下。

先查看有哪些

git fsck --full

然后查看已经没有的引用

git reflog expire --expire=now --all

清理

git gc --prune=now

参考:
http://www.tekkie.ro/news/howto-remove-all-dangling-commits-from-your-git-repository/


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *