How do I 'git diff' on a certain directory?

141

git diff actually runs a diff on all source code. How do I do this on a certain directory, so that I can view modifications on files underneath it?

This question is tagged with git

~ Asked on 2011-12-05 07:09:40

The Best Answer is


139

Provide a path (myfolder in this case) and just run:

git diff myfolder/

~ Answered on 2011-12-05 07:13:57


62

If you're comparing different branches, you need to use -- to separate a Git revision from a filesystem path. For example, with two local branches, master and bryan-working:

$ git diff master -- AFolderOfCode/ bryan-working -- AFolderOfCode/

Or from a local branch to a remote:

$ git diff master -- AFolderOfCode/ origin/master -- AFolderOfCode/

~ Answered on 2015-06-22 02:09:37


Most Viewed Questions: