2014-02-06 73 views
3

我遇到了我的第一个运行git gc的请求。我在我的最后收到的提交的信息是:安全运行git gc

warning: There are too many unreachable loose objects; run 'git prune' to remove them. 

和...

You may also run "git gc" manually. See "git help gc" for more information. 

所以我的问题是怎样运行git gc --aggressive--auto--prune--quiet

基本上我担心我可能会丢失任何提交历史或以任何方式破坏我的主分支?

有什么建议吗?

回答

3

一般而言,git gc可以安全运行。它不会丢弃任何可从任何命名参考访问的提交。根据您设置适当的过期变量的方式(例如,gc.pruneexpire,gc.reflogexpire等),它可能会丢弃仅从reflog可访问的提交或完全不可访问的提交。我让git gc决定何时自行修剪(查看那些过期的设置),并通常执行git gc --aggressive。它在工作时显示一些统计数据。如果你不想看到这些,然后添加--quiet

+0

非常感谢您的建议。我遵循了你的建议,没有任何问题。非常感谢 – Volterony