Comment changer son email dans l'historique des commits git ?

Je me rend compte que mon email était mal configuré depuis pas mal de temps dans mon .gitconfig. Juste une coquille à la con. Voici apres quelques recherche et tests comment j'ai réussi à changer mon email dans l'historique:

$ git filter-branch --commit-filter '
      if [ "$GIT_AUTHOR_EMAIL" = "old_email@provider.com" ];
      then
              GIT_AUTHOR_NAME="NEW NAME";
              GIT_AUTHOR_EMAIL="new_email@provider.com";
              GIT_COMMITTER_NAME="NEW NAME";
              GIT_COMMITTER_EMAIL="new_email@provider.com";
              git commit-tree "$@";
      else
              git commit-tree "$@";
      fi' -- --all

Et ensuite, si tout va bien :

$ rm -r .git/refs/original

Pour pousser tout ca sur un depot remote il faut ajouter un '-f' :

$ git push -f

Source sur stackoverflow.