重写Github作者/提交历史

时间:2014-04-14 01:52:03

标签: git github

我之前没有在我的开发环境中正确配置我的用户名和电子邮件,所以我的提交没有该信息,在我的贡献图中没有出现这些提交。我已将此修复,以备将来使用。我正在尝试使用github提供的脚本来修复先前的提交但是没有成功,下面我已经粘贴了脚本,因为我正在使用它。我做错了什么?

#!/bin/sh

git filter-branch -f --env-filter '

an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"

if [ "$GIT_COMMITTER_EMAIL" = "myemail@gmail.com" ]
then
    cn="justinrsmith"
    cm="justinrsmith88@gmail.com"
fi
if [ "$GIT_AUTHOR_EMAIL" = "myemail@gmail.com" ]
then
    an="justinrsmith"
    am="justinrsmith88@gmail.com"
fi

export GIT_AUTHOR_NAME="$an"
export GIT_AUTHOR_EMAIL="$am"
export GIT_COMMITTER_NAME="$cn"
export GIT_COMMITTER_EMAIL="$cm"
'

1 个答案:

答案 0 :(得分:2)

我已经解决了这个问题,不得不做git push -f origin