Git search object by commit comment

Git search object by commit comment
Git search object by commit comment

Here is command for Git search object using commit comment, Git search object commit comment or Git search object by commit comment. Get commit all detail based on commit comment word or full comment.

By using below commands we can search Git commit object by commit comment and get details like commit object, Author, Date and full comment of commit.

Different commands for Git search object commit comment:

  1. Command: Get full commit detail based on commit comment
  2. Command: Get git commit detail by comment and display in format
  3. Command: Get file list based on commit object

1. Command: Get full commit detail based on commit comment

git log --grep="my coMMent"

//output
commit a1590....
Author: Vevlo 
Date:   Wed Jun 15 22:30:27 2016 +0530

    This is my coMMent

2. Command: Get git commit detail by comment and display in format

git log --grep="my coMMent" --pretty=format:"%cn | %H | %cd | %B"

//output
Vevlo | a1590.... | Wed Jun 15 22:30:27 2016 +0530 | This is my coMMent

3. Command: Get file list based on commit object

git show --pretty="format:" --name-only a1590....

//output
path/to/file/file1.php
path/to/file/file2.php

Links for git grep and git history search

Advanced Git log
View commit history
Git grep