Background: I recently published the Eureka source code. The code was embedded in a much larger repository, and I only wanted to include files in the "eureka/" subdirectory. I wanted to include history only for commits that thouched those files. Below are a few commands that turned out useful.
To modify the content of a file (across entire repository history):
$ git filter-branch -f --prune-empty --tree-filter 'sed -i "" "s/BAD TEXT/GOOD TEXT/" eureka/*'