How to search in commit messages using command line? [duplicate]

Solution 1:

git log --grep=<pattern>
    Limit the commits output to ones with log message that matches the 
    specified pattern (regular expression).

--git help log

Solution 2:

git log --oneline | grep PATTERN