title: How to grep Git commit diffs or contents for a certain word
body: <p>In a Git code repository I want to list all commits that contain a certain word. I tried this</p>
  <pre class="lang-sh prettyprint-override"><code>git log -p | grep --context=4 &quot;word&quot;
  </code></pre>
  <p>but it does not necessarily give me back the filename (unless it's less that five lines away from the word I searched for. I also tried</p>
  <pre class="lang-sh prettyprint-override"><code>git grep &quot;word&quot;
  </code></pre>
  <p>but it gives me only present files and not the history.</p>
  <p>How do I search the entire history so I can follow changes on a particular word? I intend to search my codebase for occurrences of word to track down changes (search in files history).</p>