8

I converted a Subversion repository to Git using git svn but unfortunately only now noticed that some of the author information was wrong. The converted repository is not shared with anybody yet, so I'd like to rewrite the commit logs in it - if possible.

How can I rewrite a git repository so that the log for all his commits show e.g.

Author: John Doe <john.doe@example.com>

instead of

Author: John Do <john.do@example.com>

I tried to do this myself, and it seems that git-filter-branch is what I need. I didn't manage to make it do this, though.

Frerich Raabe
  • 90,689
  • 19
  • 115
  • 207

1 Answers1

21

The ProGit book has an example of doing this that should probably work for you.

$ git filter-branch --commit-filter '
    if [ "$GIT_AUTHOR_EMAIL" = "schacon@localhost" ];
    then
            GIT_AUTHOR_NAME="Scott Chacon";
            GIT_AUTHOR_EMAIL="schacon@example.com";
            git commit-tree "$@";
    else
            git commit-tree "$@";
    fi' HEAD
bdukes
  • 152,002
  • 23
  • 148
  • 175