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.

  • PHPStorm use private key to sign commit
  • git server information or ascii on remote operations (clone)
  • Project B inside Project A's subfolder - committing local changes to Project B remote
  • How to concatenate two git histories?
  • Does GitHub for Windows work with GitLab?
  • Git deleted my files. Can they be recovered?
  • Git strategy for merging to a Prod branch from two different code lines (regular release branch and a hotfix branch)
  • Git: pull vs. fetch→pull
  • How can I calculate the number of lines changed between two commits in git?
  • How to I get diffmerge running as the merge tool for git
  • Remove GitHub commit history for particular day
  • What is git hawser?
  • 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.