我担心我的隐私,不希望在github提交记录中出现我的真名。我刚刚发现,github保存了我的user.name和github用户名作为贡献者。我已经更改了本地git的user.name,以便未来的提交记录不会有问题。但是我现在想知道如何回去更改之前在github仓库中提交的user.name?
git rebase -i -p <some HEAD before all of your bad commits>
然后在rebase文件中将所有错误的提交标记为“edit”。接下来,当git要求您修改每个提交时,请执行以下操作
git commit --amend --author "New Author Name <email@address.com>"
保存并关闭打开的编辑器,然后执行
git rebase --continue
继续变基操作。
添加--no-edit
以跳过打开编辑器,使命令变为:
git commit --amend --author "New Author Name <email@address.com>" --no-edit && \
git rebase --continue
更改作者和提交者:
git -c user.name="New Author Name" -c user.email=email@address.com commit --amend --reset-author