GIT: Changed File Names With Certain Extension
When 开发者_JAVA技巧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?
just leverage grep:
git diff --name-only | grep .php
git diff --name-only '**/*.php'
(note the quotes)
Edit
Most POSIX shells don't support that pattern. From your comment, I gather that git doesn't either (I cannot test right now).
A workaround could be
git diff --name-only $(find . -name \*.php)
Use quotes to get git to perform the filter:
git diff --name-only "*.php"
精彩评论