git diff filtered by file name

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.


File arguments to git diff need to be delimited by -- - try this:

find . -name <pattern> | xargs git diff --

xargs makes sure spaces, tabs, newlines, etc are handled correctly.

You could debug it with the --name-status argument to git diff. You could also try:

git diff --name-only | grep <pattern>

[edit] Try:

git diff --name-status -- `find . -name '<pattern>'`
ebg@taiyo(98)$ git diff --name-status -- `find . -name '*.scm'`
M       scheme/base/boolean.scm
M       surf/compiler/common.scm
M       surf/compiler/compile.scm
M       surf/compiler/expand.scm

Probably the simplest option is to use:

git diff "*/*AssemlyInfo.cs"

works as of git 2.20.1