Being a piece of text inside a file and not a whole file is somewhat more complicated but you can copy the contents of the file and use: git filter-branch
or BFG Repo-Cleaner
Head over to here for more information.
Extensive information:
You have to use BFG Repo-Cleaner since it is faster and has more options than git filter-branch
:
First you have to create a file and put in the text you want to replace:
$ echo "soy un dato sensible" > toReplace.txt
Then using BFG you have to execute this:
$ git clone --mirror git://example.com/my-repo.git
$ java -jar bfg.jar --replace-text toReplace.txt my-repo.git
$ cd my-repo.git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
$ git push
What will happen is that it will look for "I am sensitive data" and change it for * * * REMOVED * * *
I insist: Read carefully the link to expand the information as it is a sensitive thing.