Git Gui: 永远得到“这个仓库目前有大约320个松散对象。”

每次我在一个特定的项目上启动 Git Gui,我都会得到这样的信息:

这个存储库目前有大约320个松散对象。

enter image description here

然后继续单击 是的,得到如下对话框:

enter image description here

问题是,当我再次打开 Git 鬼,我收到了完全一样的信息,再次约320个松散的对象!就好像点击 是的根本没有任何效果。

27222 次浏览

Just simply skipping the pop up, as How to skip "Loose Object" popup when running 'git gui' suggests in the accepted answer is overlooking the fact that Git is communicating a possible performance issue to you. This should be fixable by running this command from the command line:

cd path/to/your/git/repo
git gc --aggressive

From the output of git help gc:

Runs a number of housekeeping tasks within the current repository, such as compressing file revisions (to reduce disk space and increase performance) and removing unreachable objects which may have been created from prior invocations of git add.

Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance.

--aggressive

Usually git gc runs very quickly while providing good disk space utilization and performance. This option will cause git gc to more aggressively optimize the repository at the expense of taking much more time. The effects of this optimization are persistent, so this option only needs to be used occasionally; every few hundred changesets or so.

This should keep the prompt from popping up for a while.

I use command:

git gc --prune=now

and no more too many loose object warning after done.

source of reference: https://git-scm.com/docs/git-gc