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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With