问题
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?
回答1:
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"
回答2:
Regarding the rebase, the error message is explicit: either add and commit first, or stash.
But regarding the commit author, if you are sure the content of that commit is yours, then check your git config user.name
/ user.email
setting: that authorship is derived from it.
来源:https://stackoverflow.com/questions/49123470/how-to-change-the-visual-code-studio-commit-authors