我正在尝试编辑一个旧的提交消息,正如here所解释的那样。
问题是,现在,当我尝试运行rebase -i HEAD~5
时,它显示的是interactive rebase already started
。
于是我尝试了:git rebase --continue
,但得到了这个错误:
error: Ref refs/heads/master is at 7c1645b447a8ea86ee143dd08400710c419b945b but expected c7577b53d05c91026b9906b6d29c1cf44117d6ba
fatal: Cannot lock the ref 'refs/heads/master'.
有什么想法吗?
发布于 2010-07-26 23:42:57
git rebase interactive现在有了一个reword
选项,这使得这个过程不那么痛苦了!
发布于 2019-01-08 22:09:10
只是想为这个提供一个不同的选择。在我的例子中,我通常在我的单个分支上工作,然后合并到master上,而我对本地的单独提交并不那么重要。
由于git钩子检查Jira上适当的票号,但区分大小写,我被阻止推送我的代码。而且,提交很久以前就已经完成了,我不想计算在rebase上有多少提交要返回。
所以我所做的是从最新的master创建一个新的分支,并将问题分支中的所有提交都压缩到新分支上的单个提交中。这对我来说比较容易,我认为把它放在这里作为未来的参考是个好主意。
来自最新的master:
git checkout -b new-branch
然后
git merge --squash problem-branch
git commit -m "new message"
发布于 2018-11-23 18:42:05
这里有一个非常好的要点,涵盖了所有可能的情况:https://gist.github.com/nepsilon/156387acf9e1e72d48fa35c4fabef0b4
概述:
git rebase -i HEAD~X
# X is the number of commits to go back
# Move to the line of your commit, change pick into edit,
# then change your commit message:
git commit --amend
# Finish the rebase with:
git rebase --continue
https://stackoverflow.com/questions/1884474
复制相似问题