如何重置较早提交的作者? [英] How to reset author of earlier commit?

查看:60
本文介绍了如何重置较早提交的作者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的本​​地提交的电子邮件错误,因此我使用以下命令将其重置.但是,它仅重置最新的本地提交.如何重置较早的版本?

  git commit --amend --reset-author --no-edit 

解决方案

DO(你可能需要根据你想编辑多远后面的承诺增加/减少20):

  git rebase -i HEAD〜20 

,对于要修改的提交,将 pick 替换为 edit (在交互式窗口中).保存并关闭.

然后,执行 git commit --amend ,进行更改,然后继续进行变基.

My local commits have wrong email so I used the following command to reset it. However, it only reset the latest local commit. How to reset the earlier ones?

git commit --amend --reset-author --no-edit

解决方案

Do (you may need to increase/decrease 20 according to how far back the commit you want to edit is):

git rebase -i HEAD~20

and, for the commit you want to amend, replace pick with edit (in the interactive window). Save, and close.

Then, do git commit --amend, make your change, and let the rebase continue.

这篇关于如何重置较早提交的作者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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