14

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,883
  • 3
  • 29
  • 41
gihan-maduranga
  • 4,381
  • 5
  • 41
  • 74

2 Answers2

14

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
  • 46,477
  • 5
  • 57
  • 104
2

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
  • 12,647
  • 2
  • 28
  • 41