This question cropped up in #rubinius today, and I'll toss the answer out there because Google wasn't particularly helpful at the time.

There are several common ways to search for a commit message in git, but in this case, we are looking for a piece of text that will only appear in the full diff.

Since you already know the string you are searching for, paging through all the changes in a particular file seems wasteful.

I am (now) aware of two ways to do this with git:

  • git log -S'some_string'
  • git whatchanged -p (after the pager comes up, type '/' and then 'some_string')

If you know of a better trick, feel free to post a comment.

Sorry, comments are closed for this article.