Is there a way to specify the maximum recursion level for recursive diff diff -r (to compare two directories)?
What I’m trying to do is compare two projects on github (one was branched from another). I now suspect there may be a remote branch in one of them that links to the other, which will let me do a diff from git, however the question still applies to filesystems in general.
Edit-Update: This answer addresses how I might have git help me perform a comparison: https://stackoverflow.com/a/5162839/340947
What’s been happening is I have cloned both repos and I am calling diff -r repoA repoB and it reports differences in the .git/ dirs, which is to be expected, yet I am uninterested in differences within these directories.
In this case it would be perfect to just show diffs between the first-level files in the directories, because this particular project does not have subdirs. If anyone has tips for how to compare two dirs while excluding particular folders (the .git/ dirs in my case) that’d be great too!
I’m not aware of any way of limiting the depth of recursion with
diff -r.You can exclude files that match a pattern with
-x PATor--exclude=PAT. Sowould be useful if you did want recursion.
In your case, just leave off the
-rsince you don’t want it to recurse.already does what you want.