git gc --auto

Category: Git - Core

git gc --auto

Run housekeeping only when needed

Runs garbage collection only if Git estimates the repository needs it, based on loose object and pack counts. Git calls it automatically after many operations. Run the full git gc manually when you want a forced cleanup.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.