I don't know if this was what you had in mind, but if you want to find all commits where the commit message contains the given word, use
$ git log --grep=word
If you want to find all the commits where the “word” was added or deleted in the contents of the file (more precisely: when the number of occurrences of the “word” changed), i.e. search for commit contents, use the so-called "pick" search using
$ git log -Sword
Good luck :)
source
share