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.
4 Solutions collect form web for “How do I git diff on a certain directory”
Provide a path ( myfolder in this case ) and just run:
git diff myfolder/
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,
$ git diff master -- AFolderOfCode/ bryan-working -- AFolderOfCode/
Or from a local branch to a remote:
$ git diff master -- AFolderOfCode/ origin/master -- AFolderOfCode/
You should make a habit of looking at the documentation for stuff like this. It’s very useful and will improve your skills very quickly. Here’s the relevant bit when you do
git help diff
git diff [options] [--no-index] [--] <path> <path>
<path>s are what you need to change to the directories in question.
Add Beyond Compare as your difftool in git and add alias for diffdir as:
git config --global alias.diffdir = "difftool --dir-diff --tool=bc3 --no-prompt"
Get the gitdiff as :
git diffdir 4bc7ba80edf6 7f566710c7