This article by SethRobertson titled On undoing, fixing, or removing commits in git explains how to fix or rewrite almost anything in Git. It just helped my to remove a sensitive API key from a file throughout the whole history of my repository.