Since you need a list of all images and css files, ideally, you should pipe your output to something like:
grep '.gif$\|.jpg$\|.png$\|.css$'
Of course you could add more relevant extensions your project might contain, such as .bmp, for instance.
If I try ls |grep -i '.gif$\|.jpg$\|.png$\|.css$'
I get a list of all files in current folder with given extensions.
Let's take a closer look at this command:
$
ensures you won't match any undesired file, such as .css.bak. $
matches end of line.
\|
allows you to specify multiple patterns, so you don't need to invoke multiple git ls-tree
to get the whole list.
Should your repo contain any files with uppercase extensions you might want to add -i
in order to run grep case insensitively.
Patterns between single '
ensures dots are interpreted as dots, and not as "any character" as meant in regexes.