Before you start...
Make a backup of the current state of your repository. Use
cp to make a copy:
$ cp -r /path/to/your/repo /path/for/your/backup
Navigate to the root of your repository. We will need to locate the name and email associated
with the commits that were not linked to you. You can do this by running:
This will show you the history of your repository. Press enter until you see one of your old
commits that was done under the wrong name or email.
Copy down the name (next to Author:) and the email address (in the <> next to the name)
exactly the way you see it. Hit
q when you are done.
Now copy (
Ctrl-C) and paste (
Shift-Insert) the following command into the terminal:
$ git filter-branch --env-filter '
[ "$GIT_AUTHOR_EMAIL"="$oldemail" ] && GIT_AUTHOR_EMAIL="$newemail"
[ "$GIT_COMMITTER_EMAIL"="$oldemail" ] && GIT_COMMITTER_EMAIL="$newemail"
[ "$GIT_AUTHOR_NAME"="$oldname" ] && GIT_AUTHOR_NAME="$newname"
[ "$GIT_COMMITTER_NAME"="$oldname" ] && GIT_COMMITTER_NAME="$newname"
Replace old name in the line,
oldname="(old name)" with the name that you copied down.
Replace old email in the line,
oldemail="(old email)" with the email that you copied down.
Replace new name in the line,
newname="(new name)" with your Github username.
Replace new email in the line,
newemail="(new email)" with your Github email address.
Double check that you type in everything correctly. Press enter to execute the command.
git log to review the history of the repository. Ensure that everything looks the way it should. This is
the last chance for you to correct any mistakes