Search code examples
gitbashgit-diffgit-bash

git diff filtered by file name


I would like the results of git diff to be filtered by the file name.

In particular, I want a diff for all of the files named "AssemblyInfo.cs", but located anywhere within the git repository.

I am using git on Cygwin, if that makes a difference.


Solution

  • The simplest method is to simply use a wildcard:

    git diff -- '*AssemblyInfo.cs'
    


    At least this works on my Git v1.8.4, bash 3.2, and zsh 5.7.