我目前正在使用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
其他回答
我是这样做的。首先,不要强迫你的改变,否则你就不走运了。抓取并安装崩溃扩展。提交另一个虚拟变更集。然后使用折叠将前两个更改集合并为一个。它将提示您输入一条新的提交消息,为您提供您已经拥有的作为起点的消息。您已经有效地更改了原来的提交消息。
好消息:hg 2.2刚刚增加了git的修改选项。
在tortoiseHg中,你可以通过选择提交按钮右侧的黑色箭头来使用“修改当前修订”
回滚-重新应用是一个非常简单的解决方案,但它只对最后一次提交有帮助。Mercurial Queues功能强大得多(注意,为了使用“hg q*”命令,您需要启用Mercurial Queues Extension)。
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之前的扩展是活跃的,所以关闭并重新开放。
使用MQ扩展和调试命令还有另一种方法。这是在不丢失数据的情况下修改历史记录的一种通用方法。让我假设和安东尼奥的情况一样。
// set current tip to rev 497
hg debugsetparents 497
hg debugrebuildstate
// hg add/remove if needed
hg commit
hg strip [-n] 498
推荐文章
- 为什么要把Gradle Wrapper提交给VCS?
- 自定义SSH端口上的Git
- Hg:如何做一个像git的rebase
- Mercurial:我可以重命名分支吗?
- Git克隆/拉不断冻结在“存储密钥在缓存?”
- 如何使用Git向远程存储库进行初始推送?
- 从pull请求中删除一个修改过的文件
- 在Mercurial中是否有删除本地提交的方法?
- Mercurial:如何修改上次提交?
- 如何使用TortoiseHG进行分支
- 如何从我的工作目录中删除所有未跟踪的文件?
- 多久向源代码控制提交一次更改?
- 如何修改旧Git提交?
- 如何处理11000行c++源文件?
- 删除git中的分支是否会将其从历史记录中删除?