What You'll Need:
$ grep -r --exclude-dir='.svn' 'my search string' /some/directoryBut that's a lot to type in each time you want to search your source code. To save keystrokes, try setting up an alias in your home directory's .bashrc file that utilizes the --exclude-dir option (for Mac, use your home directory's .profile file.). I call mine devgrep:
alias devgrep="grep --exclude-dir='.svn'"After adding the alias, don't forget to source your .bashrc:
$ source ~/.bashrcNow whenever you need to search a Subversion working copy recursively, use the new alias to skip .svn directories:
$ devgrep -rin 'doctype' /var/www/html/templates ./foo.tpl:1:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ./bar.tpl:1:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ./baz.phtml:1:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">You can also exclude file types when grep'ing. If you're a vim user, it can be helpful to skip .swp files in your alias:
alias devgrep="grep --exclude-dir='.svn' --exclude='*.swp'"Yet another workaround would be to use ack - a Perl based, juiced up version of grep with a lot more features.