Is it possible to compare two directories in Git

gihan-maduranga picture gihan-maduranga · Jul 21, 2017 · Viewed 8.1k times · Source

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/

Answer

LeGEC picture LeGEC · Jul 21, 2017

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/