title: How to execute a script on change-sets introduced by old commits?
body: <p>How can I edit the <strong>change-sets</strong> introduced by a significant number of old commits in my repository. For example I want to change all appearances of "<strong>foo</strong>" with "<strong>bar</strong>" in all my files changed along several commits. Because there is a big number of commits, I don't want to do that manually. I know that "<strong>git rebase -i</strong>" has the option to "<strong>exec</strong>" ("x, exec = run command (the rest of the line) using shell") but how can I specify the change-set on which I want the script to run?</p>
  
  <p>Let's assume I have the history structure as shown bellow:</p>
  
  <pre><code>                    A---B---C---D.....---P---Q topic
                     /
             A'---B'---C' master
  </code></pre>
  
  <p>Many of the commits A, B, .... P and Q have introduced in the source files the word "<strong>foo</strong>". Now I want to change all those appearances of "<strong>foo</strong>" with "<strong>bar</strong>" but to also keep the history as it is now (i.e. have the separate commits as they are). How can I do that?</p>