Git清除不被任何分支所有的commit

在一个分支上开发,有一些commit没有merge进master,后来放弃这个分支,不想继续开发了,那么这些没merge的commit就丢失了,称为dangling

想要清除这些commit,运行:

git reflog expire --expire-unreachable=now --all
git gc --prune=now

参考资料:

http://stackoverflow.com/questions/3765234/listing-and-deleting-git-commits-that-are-under-no-branch-dangling

 

posted on 2013-11-24 09:48  大宝pku  阅读(723)  评论(0编辑  收藏  举报

导航