0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【git】git grep リポジトリ内で文字列検索

Last updated at Posted at 2025-02-21

git リポジトリ内で文字列の検索を行いたい時のコマンドを紹介します。

以下のコードがあったとします。

@Entity
public class TestEntity {

    @Id
    private Long id;

    private String name;
}

このクラスで"name"という文字列の検索を行いたいとき git grep コマンドを使います。

% git grep name /Users/~/~/TestEntity.java  

すると下記のように表示されます。
スクリーンショット 2025-02-22 1.32.30.png

ちなみに name を大文字にしてみると、、、

% git grep NAME /Users/~/~/TestEntity.java
% 

ヒットはしません。
大文字、小文字の区別もしてくれるんですね。

以上です。
最後までご覧いただきありがとうございました。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?