Git: Changed File Names With Certain Extension

For example, how to find changed PHP files between latest and the commit before it: 1

git diff --name-only HEAD~1 HEAD '**/*.php'

If the shell does not support the glob pattern, use grep

git diff --name-only HEAD~1 HEAD | grep .php

Comments