GIT: changed file names with a specific extension

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

git diff --name-only

But many times I get a lot of files that I don’t need right now. For example, if I upload to my PHP server, I usually just need a list of .php files. I tried this:

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

But, unfortunately, it only shows files in the first subdirectory. This does not appear to be a double star interpretation as recursive.

Any idea?

+3
source share
2 answers

just use grep:

git diff --name-only | grep .php
+8
source
git diff --name-only '**/*.php'

(note the quotation marks)

Edit

POSIX . , , git ( ).

git diff --name-only $(find . -name \*.php)
+2

Source: https://habr.com/ru/post/1786365/


All Articles