【问题标题】:How do I rewrite committer names in a git repository? [duplicate]如何在 git 存储库中重写提交者名称? [复制]
【发布时间】:2010-12-06 17:05:34
【问题描述】:

我使用 git svn 将 Subversion 存储库转换为 Git,但不幸的是直到现在才注意到一些作者信息是错误的。转换后的存储库尚未与任何人共享,因此我想重写其中的提交日志 - 如果可能的话。

如何重写 git 存储库,以便显示他所有提交的日志,例如

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

而不是

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

我自己尝试过这样做,看来git-filter-branch 是我需要的。不过,我没能做到这一点。

【问题讨论】:

    标签: git


    【解决方案1】:

    The ProGit book 有 an example of doing this 可能对你有用。

    $ 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
    

    【讨论】:

    • 别忘了GIT_COMMITTER_NAME。
    • 这只适用于 master 分支
    猜你喜欢
    • 1970-01-01
    • 2021-03-27
    • 2021-12-22
    • 2015-09-14
    • 2011-09-03
    • 2013-03-20
    • 2010-12-09
    • 2016-01-04
    • 1970-01-01
    相关资源
    最近更新 更多