LoginSignup
0
0

More than 3 years have passed since last update.

git のすべてのコミットから検索する

Last updated at Posted at 2020-10-29

git のすべてのリビジョンから検索する

git grep で git リポジトリから grep 検索できますが、

git grep では検索対象のコミットを引数に指定できます。
git rev-list --all ですべてのコミットをリストアップできます。

あわせて、以下のコマンドでgit のすべてのコミットから検索できます。

git grep 検索パターン $(git rev-list --all)

以下でも OK (リビジョン数に上限がないのでこちらのほうが便利)

git rev-list --all | xargs git grep 検索パターン

以下のような alias を作っておくと便利かも

alias gg='git rev-list --all | xargs git grep'

参考
https://stackoverflow.com/questions/2928584/how-to-grep-search-committed-code-in-the-git-history

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0