How to Find commits in the history (Git)
we will use the JGit repository, trying to find commits related to the "Performance" keyword. In this recipe, we will look through the entire history, so we don't need the master branch to point to a specific commit.
Step 1 : we can use the --grep option to find specific strings in commit messages. In this recipe, we look at the entire history and search every commit that has "Performance" in its commit message:
git log --grep "Performance" --oneline --all
Step 2 : Note that the search is case sensitive—had we searched for "performance" (all in lower case), the list of commits would have been very different:
git log --grep "performance" --oneline --all
Step 3 : We also could have used the Find feature in gitk to find the same commits. Open gitk with the --all switch, type Performance in the Find field, and hit Enter. This will highlight the commits in the history view, and you can navigate to the previous/next result by pressing Shift + up arrow, Shift + down arrow, or the buttons next to the Find field. You will still, however, be able to see the entire history in the view with the matching commits highlighted: