我需要 SOS 帮助,我向 bitbucket 提交了一个项目并以我的名字提交,但我需要更改作者姓名(和电子邮件地址)。
最简单的方法是什么?
您可以简单地修改最后一次提交并推送(强制)
git commit --amend --author="Your name <[email protected] /cdn-cgi/l/email-protection>"
git push --force
As 评论了 https://stackoverflow.com/questions/56724846/change-commiter-author-name/56724874?noredirect=1#comment100009747_56724874通过 [OznOg],如果git config user.name
and git config user.email
显示正确的值,a--reset-author https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---reset-author足够的:
git commit --reset-author
git push --force
Your branch is ahead of 'origin/master' by 2 commits.
因此,BitBucket 上的最新提交并不是本地最新的提交:您还进行了另外两次提交。
首先检查是否可以从 bitbucket 重置该值。
git checkout -b tmp
git reset --hard origin/master
git commit --amend --author="Your name <[email protected] /cdn-cgi/l/email-protection>"
git push --force
如果您看到的内容没有问题,那么您可以应用下两个提交:
git cherry-pick tmp~1
git commit --amend --author="Your name <[email protected] /cdn-cgi/l/email-protection>"
git cherry-pick tmp
git commit --amend --author="Your name <[email protected] /cdn-cgi/l/email-protection>"
git push
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)