Retroactively Correct Authors with Git SVN?

Start out by seeing what you’ve got to clean up:

git shortlog -s

For each one of those names, create an entry in a script that looks like this (assuming you want all the authors and committers to be the same):

#!/bin/sh

git filter-branch --env-filter '

n=$GIT_AUTHOR_NAME
m=$GIT_AUTHOR_EMAIL

case ${GIT_AUTHOR_NAME} in
        user1) n="User One" ; m="user1@example.com" ;;
        "User Two") n="User Two" ; m="user2@example.com" ;;
esac

export GIT_AUTHOR_NAME="$n"
export GIT_AUTHOR_EMAIL="$m"
export GIT_COMMITTER_NAME="$n"
export GIT_COMMITTER_EMAIL="$m"
'

That’s basically the script I used for a large rewrite recently that was very much as you described (except I had large numbers of authors).

edit Use π pointed out a quoting problem in my script. Thanks!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)