title: Git: discover which commits ever touched a range of lines
body: <p>I'm having trouble figuring out how to use <code>git blame</code> for getting the set of commits that <em>ever</em> touched a given range of lines. There are similar questions like <a href="https://stackoverflow.com/questions/5098256/git-blame-prior-commits">this one</a> but the accepted answer doesn't bring me much further.  </p>
  
  <p>Let's say I have a definition that starts on line 1000 of <code>foo.rb</code>. It's only only 5 lines long, but the number of commits that ever changed those lines is enormous. If I do</p>
  
  <pre><code>git blame foo.rb -L 1000,+5
  </code></pre>
  
  <p>I get references to (at most) five distinct commits that changed these lines, but I'm also interested in the commits "behind them". </p>
  
  <p>Similarly,</p>
  
  <pre><code>git rev-list HEAD -- foo.rb | xargs git log --oneline
  </code></pre>
  
  <p>is almost what I want, but I can't specify line ranges to <code>git rev-list</code></p>
  
  <p>Can I pass a flag to <code>git blame</code> to get the list of commits that ever touched those five lines, or what's the quickest way to build a script that extracts such information? Let's ignore for the moment the possibility that the definition once had more or less than 5 lines. </p>