Git:git logコマンドでコミットメッセージを検索(grep)する方法

スポンサーリンク

git logコマンドでコミットメッセージを検索(grep)する方法

git logコマンドでコミットメッセージを検索(grep)するには--grepオプションを指定します。

 

オプションの説明

 --grep=
     Limit the commits output to ones with log message that matches the specified pattern (regular expression). With more than one --grep=, commits
     whose message matches any of the given patterns are chosen (but see --all-match).

     When --notes is in effect, the message from the notes is matched as if it were part of the log message.

 

--grepオプションを指定した場合

$ git log --grep='from hell' | head
commit 57d84f8d93a0e0818fc403c5b1a2ba73ce0eca5a
Author: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date:   Mon Aug 6 18:27:09 2012 +0700

    read_index_from: remove bogus errno assignments

    These assignments comes from the very first commit e83c516 (Initial
    revision of "git", the information manager from hell - 2005-04-07).
    Back then we did not die() when errors happened so correct errno was
    required.

キャプチャ画像

git-log-grep