My git repository is starting to get a bit too large. On a single SSD, I have a repository and two clones with a lot of binary files that take up an awful lot of space.
Every day, a cron job pushes the master clone to the repository to create a history of changes over a long period of time.
However, anything over a month old isn't really worth keeping anymore. I'd like to be able to remove those old commits to save a lot of space... programatically.
I've seen plenty of examples using rebase
and squash
, a couple using gc
, and some other really funky ones. Most of these require you to manually type in the commit tags you want to remove.
I want to remove all commits older than 30 days from my repository (I suppose I'll have to configure hooks to collapse the history elsewhere too) every month from a bash script.