I have a find command that I run to find files whose names contain foo.
I want to skip the .git directory. The command below works except it prints an
annoying .git any time it skips a .git directory:
find . ( -name .git ) -prune -o -name '*foo*'
How can I prevent the skipped .git directories from
printing to the standard output?
Try this one:
This will still traverse into the .git directories, but won’t display them. Or you can combine with your version:
You can also do it without grep: