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.

  • How can I 'git merge' a new file based on a tracked file of a different name?
  • Two git repositories in one directory?
  • How to get Git to convert CRLF files to LF, on Linux?
  • editing commits with git rebase
  • Permission denied error when using Github deploy keys
  • Git: can we compare two staged-version of the same files?
  • Is it possible to fast forward another branch without checking it out?
  • Git-hooks pre-push script does not receive input via STDIN
  • git archive - Multiple gits
  • Git for Web Development (procedure method)
  • git clone vs copy paste, what's the difference?
  • Git change author name/email in a long ago commit in team repo
  • 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, 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/

    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>

    The two <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


    Git Baby is a git and github fan, let's start git clone.