我不确定为什么,但我的 Visual Studio Code 显示了错误的提交作者姓名。我正在尝试更改提交的作者。我怎样才能做到这一点?我已经有很多东西了,但运气不好。
这是我尝试过的:
因为我有三个提交,所以我尝试了 git rebase -i HEAD~3
,
但我收到此错误:
Cannot rebase: You have unstaged changes. Please commit or stash them.
最佳答案
对于问题:无法 rebase :您有未暂存的更改。请提交或隐藏它们。
你可以做到
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"
关于visual-studio - 如何更改 visual code studio 提交作者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49123470/