Git rebase 更改作者?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16217801/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 16:02:18  来源:igfitidea点击:

Git rebase change author?

git

提问by Steven

So I stupidly made 3 commits on a machine that was not configured for git (no author or email) and I want to change those 3 commits (have not been pushed) authors to what they are suppose to be.

所以我愚蠢地在一台没有为 git(没有作者或电子邮件)配置的机器上进行了 3 次提交,我想将这 3 次提交(尚未推送)作者更改为他们假设的内容。

I know git commit --amendcan change the author, but how can I do it to 3? I know rebase can change the message. Is there a way to change author?

我知道git commit --amend可以改变作者,但我怎么能做到 3 呢?我知道 rebase 可以更改消息。有没有办法改变作者?

采纳答案by Yang

You can use interactive rebase. The answer from this post gives you an example: Change commit author at one specific commit.

您可以使用交互式变基。这篇文章的答案为您提供了一个示例: Change commit author at a specific commit

The author asks for changing author at a specific commit, but interactive rebasing can be used to change authors of multiple commits if you editall commits that you wish to change.

作者要求在特定提交时更改作者,但如果edit您希望更改所有提交,则可以使用交互式变基来更改多个提交的作者。

Other potential useful techniques related to interactive rebasing could be found in the Pro Git book http://git-scm.com/book/en/Git-Tools-Rewriting-History, including squashing, redordering, editing messages, etc.

其他与交互式变基相关的潜在有用技术可以在 Pro Git 书籍 http://git-scm.com/book/en/Git-Tools-Rewriting-History 中找到,包括压缩、重新排序、编辑消息等。