9

I have installed Meld as diff tool in Git. Is it possible to compare two folders using Git or any other way? I tried the following command but nothing happened.

git diff /c/sample/folder1/ /c/sample/folder2/
Tatsuyuki Ishi
  • 3,696
  • 3
  • 27
  • 39
gihan-maduranga
  • 4,049
  • 3
  • 40
  • 73

2 Answers2

8

If you want to compare two directories on your disk, no need for git :

# use any suitable diff viewer : meld, kdiff3 ...
meld /c/sample/folder1/ /c/sample/folder2/

If you want to have a directory view for the diff between two commits in git :

git difftool -d <commit1> <commit2>

# you can also restrict this directory view to a subdir of your repo :
git difftool -d <commit1> <commit2> -- lib/
LeGEC
  • 35,975
  • 2
  • 46
  • 87
1

It actually is perfectly normal to compare different versions of folders in a git repository using git diff master..yourbranch path/to/folder (see this question).

If it's not about versions, but just comparing two folders, meld can do it:

Meld lets you compare two or three folders side-by-side. You can start a new folder comparison by selecting the File ▸ New... menu item, and clicking on the Directory Comparison tab.

(from here).

kowsky
  • 9,868
  • 1
  • 27
  • 39
  • 9
    Also, if you want to use Git to compare two arbitrary folders, you can use the --no-index option: ```git diff --no-index dir1 dir2``` – padawin Jul 21 '17 at 14:51