I have use gitlabhq configed a git server.
All Repos save in /repos/
directory at server.
I have a project, and have a branch, this branch have big files.
For save disk space, i delete this branch use git push origin :test
.
But when i go to my git server, found this project repo size not change.
So my questions is how to reduce server git repo size when delete a branch?
I have used git filter-branch --tree-filter 'rm -f bigfile.zip' HEAD, also seems can not reduce server git repo size.
Deleting files in a commit doesn't actually reduce the size of the repo since the earlier commits and blobs are still around. What you need to do is rewrite history with Git's filter-branch option.
remove the file from your project's current file-tree. remove the file from repository history — rewriting Git history, deleting the file from all commits containing it. remove all reflog history that refers to the old commit history. repack the repository, garbage-collecting the now-unused data using git gc.
You git branches don't take space. That is, if you remove one of your branches you usually don't remove much content (even without taking into account compression).
I have resolved it by run below command in server.
bash
git gc --aggressive --prune=now
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