Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rewrite committer names in a git repository? [duplicate]

Tags:

git

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 <[email protected]>

instead of

Author: John Do <[email protected]>

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.

like image 895
Frerich Raabe Avatar asked Oct 14 '09 14:10

Frerich Raabe


People also ask

How do I change a git committer?

If you also want to change your first commit (also called the 'root' commit), you will have to add --root to the rebase call. This will change both the committer and the author to your user.name / user.


1 Answers

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="[email protected]";
            git commit-tree "$@";
    else
            git commit-tree "$@";
    fi' HEAD
like image 167
bdukes Avatar answered Nov 11 '22 14:11

bdukes