It seems like git gc --aggressive
really cleans up my repo, but when I do git push
everything is already up-to-date. Is there a way to clean up the server?
The --aggressive option causes git gc to spend more time on its optimization effort. This causes git gc to run slower but will save more disk space after its completion. The effects of --aggressive are persistent and only need to be run after a large volume of changes to a repository.
auto below for how to disable this behavior. Running git gc manually should only be needed when adding objects to a repository without regularly running such porcelain commands, to do a one-off repository optimization, or e.g. to clean up a suboptimal mass-import.
The easiest option would be to use a scheduled task in windows or a cron job in Unix to run git gc periodically. This way you don't even need to think about it.
You should consider running git gc manually in a few situations: If you have just completed a git filter-branch . Recall that filter-branch rewrites many commits, introduces new ones, and leaves the old ones on a ref that should be removed when you are satisfied with the results.
I know that Github will run git gc periodically as the Github support mentions in this thread.
I don't know if you can force it yourself though.
I didn't see such a service in the Github hooks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With