1

git log --grep=searchstringすべてのコミットメッセージの最初の行のみを検索するように見えます。コミットメッセージ全体を検索するにはどうすればよいですか?

4

1 に答える 1

1

のどのバージョンgitを使用していますか? バージョン 1.7.7.6 では、--grepオプションはコミット メッセージの内容全体を検索するように見えます。たとえば、次のログを見てください。

$ git log
commit 7d3f6ed90467f40de32ea4e59f8fa4172735d577
Author: Lars Kellogg-Stedman <lars@seas.harvard.edu>
Date:   Wed May 9 14:10:12 2012 -0400

    i added a file

    this is the second line.

commit 3aaf84486d0f1eb41fb5406254f795a581ef0ce2
Author: Lars Kellogg-Stedman <lars@seas.harvard.edu>
Date:   Wed May 9 14:10:01 2012 -0400

    i made a change

commit eb6cd7773ff68808a9eda2e7edb8fbffcc1f6759
Author: Lars Kellogg-Stedman <lars@seas.harvard.edu>
Date:   Wed May 9 14:09:45 2012 -0400

    this is the first line

    this is the second line

という単語をgrepすると、次のsecondようになります。

$ git log --grep=second
commit 7d3f6ed90467f40de32ea4e59f8fa4172735d577
Author: Lars Kellogg-Stedman <lars@seas.harvard.edu>
Date:   Wed May 9 14:10:12 2012 -0400

    i added a file

    this is the second line.

commit eb6cd7773ff68808a9eda2e7edb8fbffcc1f6759
Author: Lars Kellogg-Stedman <lars@seas.harvard.edu>
Date:   Wed May 9 14:09:45 2012 -0400

    this is the first line

    this is the second line

これは明らかに最初の行以外のものと一致しています。

于 2012-05-09T18:12:07.600 に答える