Git Cleaning

return home
By default, a Git repository gets bigger and bigger or older and older. To counteract the aging process of git repos I wrote two simple scipts, one for the server hosting the repos, and one for the client, to do some housekeeping.


gclean is the server side script to run over the hosted directory and git-clean all repos found in that directory. The git-clean process is aggressive by default to achieve the biggest space savings.


gitupdate is the client side script to run over the git or github directory and do the housekeeping. It tries to do a fast-forward merge with the default upstream branch, if that does not work out, it just fetches the data. (This is kept apart because some configuration can break the pull and not the fetch)
After doing that it cleans up aggressively.


Usage cases are stated in both scripts. I use gitupdate in my crontab at startup in one of my git folders (the smaller one), for my bigger github folder I run the scipt once every day.
On my private git hosting server I run gclean every 8 hours.

return home