LoginSignup
2
2

More than 5 years have passed since last update.

`git grep -e`で`--not`を使う場合の書き方

Posted at

概要

表題の通り。ググってもあまり情報なかったので書いておく。

記法

git grep --not -e "__IGNORE__"

実践

「"A"を含み、且つ"B"を含まない」といった条件を与えたい場合、以下のように書く。
要は、--and/--or/--notで、-e __KEYWORD__を演算子的に結ぶように書くイメージ。()も使えるので、複雑な条件も表現しようと思えばできる。

git grep -e "A" --and --not -e "B"

「"A"を含まない」的な--notのみの条件も書ける。大量にヒットするので、これだけで使うかどうかは微妙だけど。

git grep --not -e "A"

参考

2
2
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
2
2