Ignore .svn when doing `diff -r`

96

12

diff has an option --recursive (-r) to do a comparison between two directories (the files inside them). Is there a way to make diff ignore certain sub-directories (eg: .svn)?

$ diff -r src1/ src2/

Sridhar Ratnakumar

Posted 2010-04-12T23:15:22.680

Reputation: 4 041

Answers

121

Add --exclude=".svn" as an option like so:

$ diff -r --exclude=".svn" src1/ src2/

Sebastian Paaske Tørholm

Posted 2010-04-12T23:15:22.680

Reputation: 4 479

1--exclude option is also not working on mac os. -x ".svn" works well. – alpert – 2016-03-29T11:13:49.140

7If you want to exclude multiple items just add another --exclude parameter. – JonMR – 2011-07-12T16:02:13.900

15If you don't want to type --exclude every time use -x ".svn" – basilikode – 2012-08-14T09:03:43.990

15

  diff --exclude=.svn ...

Ignacio Vazquez-Abrams

Posted 2010-04-12T23:15:22.680

Reputation: 100 516