The following shell command will crawl your hard drive, from your current directory, looking for any git repositories. When it finds them it will garbage collect, prune, and pack them, regaining your disk space and make your repositories operate faster.
1 2 | #!/bin/sh find . -type d -name .git | while read dir; do pushd "$dir"; git gc --prune; popd; done |
You can run this directly from the terminal or just turn this snippet into a lil bash script file for easy executing later, i.e.
$ nano git_garbage_collect.sh
$ # copy & paste the script into the file
$ ctrl+o # to save the file
$ ctrl+x # to exit nano
Then just run it like any other bash script
Need web application development, maintenance for your existing app, or a third party code review?
Velocity Labs can help.
{ 0 comments }