DOSKrupp
DOSKrupp

Reputation: 240

How to avoid .git files when comparing two folders

I have git installed on my Mac. I am trying to make a diff between files in two different folders.

diff -rq PATH_Folder1/ PATH_Folder2/ > Desktop/DIFF.txt

The results include .git files.

Example:
Files PATH1/abi/cpp/.git/index and PATH2/abi/cpp/.git/index differ.

How can I avoid comparing .git files. I don't require comparing git indices.

Upvotes: 1

Views: 193

Answers (2)

apadana
apadana

Reputation: 14620

You can use the -x option to exclude file patterns. So for this case it would be:

diff -rq -x .git PATH_Folder1/ PATH_Folder2/ > Desktop/DIFF.txt

Upvotes: 2

JoErNanO
JoErNanO

Reputation: 2488

You could use git diff rather than simple diff, which should know to avoid .git files and the like. Here is the reference for the git diff command.

Even better would be using a graphical diff tool with

$ git difftool -t meld

or

$ git difftool -t kdiff3

Several guides and howtos exist out there. This is a good example.

Upvotes: 2

Related Questions