我目前正在使用TortoiseHg (Mercurial),不小心提交了一个错误的提交消息。如何在存储库中编辑这条提交消息?
当前回答
使用MQ扩展和调试命令还有另一种方法。这是在不丢失数据的情况下修改历史记录的一种通用方法。让我假设和安东尼奥的情况一样。
// set current tip to rev 497
hg debugsetparents 497
hg debugrebuildstate
// hg add/remove if needed
hg commit
hg strip [-n] 498
其他回答
回滚-重新应用是一个非常简单的解决方案,但它只对最后一次提交有帮助。Mercurial Queues功能强大得多(注意,为了使用“hg q*”命令,您需要启用Mercurial Queues Extension)。
我是这样做的。首先,不要强迫你的改变,否则你就不走运了。抓取并安装崩溃扩展。提交另一个虚拟变更集。然后使用折叠将前两个更改集合并为一个。它将提示您输入一条新的提交消息,为您提供您已经拥有的作为起点的消息。您已经有效地更改了原来的提交消息。
使用MQ扩展和调试命令还有另一种方法。这是在不丢失数据的情况下修改历史记录的一种通用方法。让我假设和安东尼奥的情况一样。
// set current tip to rev 497
hg debugsetparents 497
hg debugrebuildstate
// hg add/remove if needed
hg commit
hg strip [-n] 498
In TortoiseHg, right-click on the revision you want to modify. Choose Modify History->Import MQ. That will convert all the revisions up to and including the selected revision from Mercurial changesets into Mercurial Queue patches. Select the Patch you want to modify the message for, and it should automatically change the screen to the MQ editor. Edit the message which is in the middle of the screen, then click QRefresh. Finally, right click on the patch and choose Modify History->Finish Patch, which will convert it from a patch back into a change set.
哦,这里假设MQ是这个存储库上TortoiseHG的活动扩展。如果没有,您应该能够单击File->Settings,单击Extensions,然后单击mq复选框。它应该警告你,你必须关闭TortoiseHg之前的扩展是活跃的,所以关闭并重新开放。
我知道这是一个老帖子,你把问题标记为答案。我正在寻找同样的事情最近,我发现histedit扩展非常有用。这个过程解释如下:
http://knowledgestockpile.blogspot.com/2010/12/changing-commit-message-of-revision-in.html
推荐文章
- 为什么我需要显式地推一个新分支?
- 没有。Git目录的Git克隆
- 在TortoiseHg储存密码
- Git与Mercurial仓库的互操作性
- “node_modules”文件夹应该包含在git存储库中吗
- 为什么要把Gradle Wrapper提交给VCS?
- 自定义SSH端口上的Git
- Hg:如何做一个像git的rebase
- Mercurial:我可以重命名分支吗?
- Git克隆/拉不断冻结在“存储密钥在缓存?”
- 如何使用Git向远程存储库进行初始推送?
- 从pull请求中删除一个修改过的文件
- 在Mercurial中是否有删除本地提交的方法?
- Mercurial:如何修改上次提交?
- 如何使用TortoiseHG进行分支