Peter Bengtsson Peter Bengtsson - 2 months ago 8
Git Question

git grep to find files

I love

git grep
to search in all files checked in to a repo. It's great. But is it possible to use it (or some other git command) to just use to find files (independent of content)?

At the moment I do this:

$ find . | grep middleware


which works but it's not using the git index which means it's going through every found file and it reports on files that are matching the
.gitignore
.

Any ideas for clever tricks?

Answer

Maybe you want git ls-files which lists the files in the index? (and automatically adjusts for your current directory inside the git work directory)

Comments