IT系/リファレンス/Gitコマンド/git_grep

Last-modified: 2020-06-11 (木) 03:56:26

git grep

ワークツリーのファイルをGrep検索するコマンド。

用例

  • ワークツリー内で"hoge"という文字列をGrep検索
    git grep hoge
  • ワークツリー内で"hoge"という文字列をGrep検索(出現した行番号も表示)
    git grep -n hoge

書式

git grep [options] <検索文字列>

公式によると以下の通り。

git grep [-a | --text] [-I] [--textconv] [-i | --ignore-case] [-w | --word-regexp]
         [-v | --invert-match] [-h|-H] [--full-name]
         [-E | --extended-regexp] [-G | --basic-regexp]
         [-P | --perl-regexp]
         [-F | --fixed-strings] [-n | --line-number] [--column]
         [-l | --files-with-matches] [-L | --files-without-match]
         [(-O | --open-files-in-pager) [<pager>]]
         [-z | --null]
         [ -o | --only-matching ] [-c | --count] [--all-match] [-q | --quiet]
         [--max-depth <depth>] [--[no-]recursive]
         [--color[=<when>] | --no-color]
         [--break] [--heading] [-p | --show-function]
         [-A <post-context>] [-B <pre-context>] [-C <context>]
         [-W | --function-context]
         [--threads <num>]
         [-f <file>] [-e] <pattern>
         [--and|--or|--not|(|)|-e <pattern>…]
         [--recurse-submodules] [--parent-basename <basename>]
         [ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | <tree>…]
         [--] [<pathspec>…]

options

/xxxx

etc.

説明

ワークツリーのファイルをGrep検索するコマンド。

関連

  • なし

参考リンク

その他メモ

なにかあれば。