[更改提交历史记录后,我的Git作者和电子邮件提交字段中有多余的引号:
Author: “JohnDoe” <“[email protected]”>
而不是:
Author: JohnDoe <[email protected]>
我使用此Github脚本(https://help.github.com/en/github/using-git/changing-author-info)更改提交历史记录。我根据需要编辑了上面的脚本(以更改all先前提交的详细信息)。我使用的最终脚本如下所示:
#!/bin/sh
git filter-branch --env-filter '
CORRECT_NAME=“JohnDoe”
CORRECT_EMAIL=“[email protected]”
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
' --tag-name-filter cat -- --branches --tags
现在,当我运行git log
时,我的提交信息看起来像这样:
commit 2abf2a3b4ead4de13d2f91d2be801cc02327db2d
Author: “JohnDoe” <“[email protected]”>
Date: Sun Oct 27 12:25:46 2019 +0000
[我相信它应该看起来像这样(注意:作者中不带引号):
commit 2abf2a3b4ead4de13d2f91d2be801cc02327db2d
Author: JohnDoe <[email protected]>
Date: Sun Oct 27 12:25:46 2019 +0000
这些引号在GitHub中出现,并阻止我的提交链接到我的帐户。
关于我做错了什么的任何想法?以及如何正确地做呢?提前非常感谢!
用CORRECT_NAME=“JohnDoe”
和CORRECT_EMAIL=“[email protected]”
替换CORRECT_NAME=JohnDoe
和[email protected]
。
它可能会给您这个警告:
A previous backup already exists in refs/original/
Force overwriting the backup with -f
在这种情况下,只需在-f
之后添加git filter-branch
。