如何更改可视代码工作室提交作者

时间:2018-03-06 04:37:21

标签: visual-studio github git-commit

我不确定原因,但我的Visual Studio代码显示错误的提交作者姓名。我正在尝试更改提交的作者。我怎样才能做到这一点?我已经有很多事情,但没有运气。

这就是我的尝试:

由于我有三次提交,我尝试了git rebase -i HEAD~3, 但是我收到了这个错误:

  

无法变基:您有未分阶段的变更。请提交或存储它们。

我现在能够做到这一点,我现在如何更改作者姓名? enter image description here

2 个答案:

答案 0 :(得分:1)

问题:Cannot rebase: You have unstaged changes. Please commit or stash them.你可以做到

git stash // To stash the changes
git rebase -i HEAD~3 // To Rebase
git stash pop // To pop the stashed changes. 

请注意,如果之前的3次提交包含您藏匿的文件,则可能会发生冲突。

对于错误的提交作者姓名 将终端cd用于项目目录并使用

git config user.name // Check your user name
git config user.email // Check the associated email

如果信息不是您想要的信息,可以使用

进行更新
git config --global user.name "newemail"
git config --global user.email "newemail@example.com"

注意:以上内容将是全局更改,这意味着它将为所有git项目更改它。如果您更喜欢仅为一个项目更改它:

git config user.name "newemail"
git config user.email "newemail@example.com"

答案 1 :(得分:0)

关于rebase,错误消息是显式的:首先添加和提交,或者隐藏。

但是对于提交作者,如果您确定该提交的内容是您的,那么请检查您的git config user.name / user.email设置:作者身份是从中提取的。