Reputation: 5251
I have a window service that generates git
branch (commit) every 10 minutes. Each commit is pushed to the server.
Each commit contains hundreds of files with significant difference from the previous version.
The service run non-stop.
after several days/weeks, .git
directory size increases dramatically (15GB) and my drive overflows. I have no problem the server increase monotonically, BUT I'd like to keep the local machine drive usage as limited as possible.
Is there a nit git command to clear all the local data (branches, tags, etc.)
I could easily remove the entire git directory, including .git
directory and have the service clone the git repository each time it runs (every 10 minutes). But I'm afraid clone operation may slow down the entire operation. So, I'm looking for a better approach.
Upvotes: 1
Views: 119
Reputation: 1323115
I don't need my local machine to "remember" all repository's history. By removing the the entire git dir and re-cloning it, the dir is at minimal & satisfying state.
I assume I can use a git command to simulate the remove-dir-and-reclone operations
The remove would not involve a git command, just a simple rm -Rf
.
The clone could take advantage of a shallow clone:
git clone --depth 1 remote-url
Upvotes: 1