如何更改视觉代码工作室提交作者 [英] how to change the visual code studio commit authors

查看:207
本文介绍了如何更改视觉代码工作室提交作者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



这是我试过的:

由于我有三个提交,我试过 git rebase -i HEAD〜3
但是我得到这个错误:


Can not重新分配:你有未分配的变化。请提交或存储它们。


现在我可以改变作者姓名了吗?

解决方案

对于这个问题:无法重新分配:您有未分配的更改。请提交或存储它们。您可以做

  git存储//存储更改
git rebase -i HEAD〜3 //重新存储
git存储弹出窗口//弹出存储的更改。

请注意,如果前3次提交包含您已隐藏的文件,则可能会发生冲突。
$ b 错误的提交作者姓名
使用您的终端 cd 放入项目目录并使用

  git config user.name //检查您的用户名
git config user.email //检查相关电子邮件

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

  git config --global user.namenewemail
来更新它$ git config --global user.email newemail@example.com

注意:以上是全球变化,意思是说更改所有 git 项目。如果你喜欢只为一个项目改变它:

  git config user.namenewemail
git config user .emailnewemail@example.com


I am not sure why, but my Visual Studio Code is showing the wrong commit author name. I am trying to change the author of the commit. How can I do that? I have already multiple things, but no luck.

This is what I tried:

Since I have three commits, I tried git rebase -i HEAD~3, but I am getting this error:

Cannot rebase: You have unstaged changes. Please commit or stash them.

I am able to get to this now, how can i change the author name now?

解决方案

For the issue: Cannot rebase: You have unstaged changes. Please commit or stash them. You can do

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

Note that if the previous 3 commits include files you have stashed, you may get conflicts.

For the wrong commit author name Using your terminal cd into the project directory and using

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

If the information is not the one you want, you can update it using

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

Note: The above will be a global change meaning that it'll change it for all git projects. If you prefer changing it only for the one project:

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

这篇关于如何更改视觉代码工作室提交作者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆