Search code examples
gitversion-controlsubdirectorygit-diff

GIT: Changed File Names With Certain Extension


When I want to get a list of the files I have changed so for, I use this command:

git diff --name-only

But many times, I get many files that I don't care about right now. For example, if I am uploading to my PHP server, I usually just want the list of .php files. I tried this:

git diff --name-only **/*.php

But unfortunately, it only shows me files in the first sub-directory. So looks like it is not interpreting the double star as recursive.

Any idea?


Solution

  • just leverage grep:

    git diff --name-only | grep .php