How do I 'git diff' on a certain directory?
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?
Solution 1:
Provide a path (myfolder in this case) and just run:
git diff myfolder/
Solution 2:
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/
Solution 3:
What I was looking for was this:
git diff <ref1>..<ref2> <dirname>