User Tools

Site Tools


git_searching

This is an old revision of the document!


Overview

How to search through commit history using either of:

  • git log
  • git grep

Examples use the Git repository for the “Pro Git” book found here.

Searching with "git log"

The git log command supports looking for commits by the content of their commit messages, or even the content of the diff they introduced. All examples here can be enhanced with the regular git log options.

Searching for author

$ git log --author="Robert P. J. Day"
$ git log --author="Robert P\. J\. Day"
$ git log --author="P\. J\."
$ git log --author="Robert P. J. Day" --oneline
$ git log -i --author="robert p. j. day"

Searching by date range

--since=<date>, --after=<date>
    Show commits more recent than a specific date.

--until=<date>, --before=<date>
    Show commits older than a specific date.

So:

$ git log --since="Feb 1, 2019"
$ git log --author="Ben Straub" --since="Jan 1, 2019" --until="Feb 1, 2019"
git_searching.1550756797.txt.gz · Last modified: 2019/02/21 13:46 by rpjday