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.
$ touch git_garbage_collect.sh
$ 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
$ ./git_garbage_collect.sh
Need web application development, maintenance for your existing app, or a third party code review?
Velocity Labs can help.
Click here to get started!
by Irish on April 19, 2010
Often it can be a pain to remember all the username/password combinations for all the different servers we touch in our day to day development. I’ve come to really like this lil’ bash function given to me by my co-worker Anthony DiGirolamo.
1 2 3
| function authme {
ssh $@ 'cat >>.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
} |
Just put it in your ~/.bash_profile file or one of the other bash settings files you may be using.
Usage is like so
$ authme deploy@www.somedomain.com
You’ll be prompted for your password then returned to the local terminal prompt. This will ssh onto the given server and concatenate your ssh public key to the authorized_keys file. Allowing you from there on out, not having to supply a password to get on the server through ssh. Good stuff