created: 2020-01-17T02:35:48.000Z

git grepで探すファイルの拡張子を指定

こんな感じでできる

$ git grep cache -- '*.java'

git grepでは -- 以降が対象パスの指定となっているので、そこにglobを書くと探索するファイルを指定できる

-- …​ Signals the end of options; the rest of the parameters are limiters.

ちなみにexcludeするときは以下のように書くようだ

$ git grep solution -- :^Documentation

Looks for solution, excluding files in Documentation.

参考

詳説 データベース ―ストレージエンジンと分散データシステムの仕組み
[ad] 詳説 データベース ―ストレージエンジンと分散データシステムの仕組み
Alex Petrov, 小林 隆浩 (単行本(ソフトカバー))