Git: Easily Remove Multiple Files After Deletion

I almost always forget to “git rm <file>” before deleting it.  Here’s a quick way to pull deleted files from a Git repository and remove them:

git rm $(git ls-files --deleted)
Advertisements

Rotating Logs for Rails on Passenger (Mac)

Like many Linux utilities not included on Mac OS X, Homebrew can provide logrotate to more effectively manage large log files. Setup:

  1. brew install logrotate
  2. Once installation is complete, create a configuration file for logrotate. I chose to use the same configuration defined here: http://overstimulate.com/articles/logrotate-rails-passenger and named the file “logrotate.conf”.
  3. We can now kick logrotate in to gear:
    /usr/loca/sbin/logrotate -f -s logrotate.status logrotate.conf

Note that in the above, I defined explicitly where to stick the logrotate status file so that it is owned by the current user and not reliant on sudo, etc.