After my harddisk crashed and I reinstalled the machine recently, I misconfigured my Git to set EMAIL as email address.
This made Git history look horrible, with incorrect email, image. By accident I even wrote an incorrect name at one point.
Note the missing image.
Now it turns out my git repository was full of EMAIL instead of my correct email address.
$git log --pretty=fuller -1 9461d8b commit 9461d8b Author: Jesper Rønn-Jensen <EMAIL> AuthorDate: Tue Jan 13 09:56:13 2015 +0100 Commit: Jesper Rønn-Jensen <EMAIL> CommitDate: Tue Jan 13 09:56:13 2015 +0100 adding install of hipchat and sourcetree
I had to rewrite the history in order to fix the email addresses. Turns out `git filter-branch` could help:
git filter-branch –env-filter ‘
> if [[ “$GIT_AUTHOR_EMAIL” = “EMAIL” || “$GIT_AUTHOR_EMAIL” = “$NEW_MAIL” ]]
> if [[ “$GIT_AUTHOR_NAME” = “Ben Alman” ]]
> GIT_AUTHOR_NAME=”Jesper Rønn-Jensen”
> GIT_COMMITTER_NAME=”Jesper Rønn-Jensen”
> export GIT_AUTHOR_NAME
> export GIT_COMMITTER_NAME
> export GIT_AUTHOR_EMAIL
> export GIT_COMMITTER_EMAIL
> ‘ — –all
10 seconds later, I could push the changed repository up back on the server. The result was much better:
Nice result :) All of this trouble was because I wanted to script the setup of a new machine. I used my clone of Ben Alman’s dotfiles, and this way his name slipped in before I figured out how to configure the .gitconfig file.
I really like that Git enables you to do almost anything. Especially that you can make mistakes and fix them later :)