本文介绍了在Git上更改旧的提交消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编辑旧的提交消息,如所述。



现在,当我尝试运行 rebase -i HEAD〜5 时,它表示交互式rebase已经开始。



然后我尝试: git rebase --continue 但是得到这个错误:

  error:Ref refs / heads / master is at 7c1645b447a8ea86ee143dd08400710c419b945b but expected c7577b53d05c91026b9906b6d29c1cf44117d6ba 
致命:无法锁定ref'refs / heads / master'。

有什么想法?

解决方案它说:



  $ git rebase  - 我HEAD〜3 
停在7482e0d ...更新了gemspec,希望能够更好地工作
现在可以用


不代表:

尝试 不是 在退出编辑器时输入 git rebase -i HEAD〜3 ,它应该可以正常工作。

(否则,在您的特定情况下, code> git rebase -i --abort 可能需要重置所有内容并允许您重试)

$ hr

As 在评论中提到, git rebase --continue 用于转发下一个任务在你修改第一次提交之后



另外,在 reword 命令 通过替换
$ b



<$ p $

$ b



 #在编辑器中更改消息。 
$ git commit --amend
$ git rebase --continue




I was trying to edit an old commit message as explained here.

The thing is that now, when I try to run rebase -i HEAD~5 it says interactive rebase already started.

So then I try: git rebase --continue but got this error:

error: Ref refs/heads/master is at 7c1645b447a8ea86ee143dd08400710c419b945b but expected c7577b53d05c91026b9906b6d29c1cf44117d6ba
fatal: Cannot lock the ref 'refs/heads/master'.

Any ideas?

解决方案

It says:

$ git rebase -i HEAD~3
Stopped at 7482e0d... updated the gemspec to hopefully work better
You can amend the commit now, with

It does not mean:

Try to not typing git rebase -i HEAD~3 when exiting the editor, and it should work fine.
(otherwise, in your particular situation, a git rebase -i --abort might be needed to reset everything and allow you to try again)


As Dave Vogt mentions in the comments, git rebase --continue is for going to the next task in the rebasing process, after you've amended the first commit.

Also, Gregg Lind mentions in his answer the reword command of git rebase:

$ git rebase -i next
# Change the message in your editor.
$ git commit --amend
$ git rebase --continue

这篇关于在Git上更改旧的提交消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 01:57
查看更多