本文翻译自:How to edit incorrect commit message in Mercurial? [duplicate]

This question already has answers here : 这个问题已经在这里有了答案 :
Mercurial: how to amend the last commit? Mercurial:如何修改上一次提交? (7 answers) (7个答案)
Closed 2 years ago . 2年前关闭。

I am currently using TortoiseHg (Mercurial) and accidentally committed an incorrect commit message. 我当前正在使用TortoiseHg(Mercurial),并意外提交了错误的提交消息。 How do I go about editing this commit message in the repository? 如何在存储库中编辑此提交消息?


#1楼

参考:https://stackoom.com/question/2c5E/如何在Mercurial中编辑错误的提交消息-重复


#2楼

Good news: hg 2.2 just added git like --amend option. 好消息:hg 2.2 刚刚添加了 git之类的--amend选项。

and in tortoiseHg, you can use "Amend current revision" by select black arrow on the right of commit button 在tortoiseHg中,您可以通过选择“提交”按钮右侧的黑色箭头来使用“修改当前修订版”


#3楼

Well, I used to do this way: 好吧,我曾经这样做:

Imagine, you have 500 commits, and your erroneous commit message is in r.498. 想象一下,您有500次提交,而错误的提交消息在r.498中。

hg qimport -r 498:tip
hg qpop -a
joe .hg/patches/498.diff
(change the comment, after the mercurial header)
hg qpush -a
hg qdelete -r qbase:qtip

#4楼

In TortoiseHg, right-click on the revision you want to modify. 在TortoiseHg中,右键单击要修改的修订。 Choose Modify History->Import MQ. 选择“修改历史记录”->“导入MQ”。 That will convert all the revisions up to and including the selected revision from Mercurial changesets into Mercurial Queue patches. 这样会将所有修订版本(包括从Mercurial变更集选择的修订版本)转换为Mercurial Queue补丁。 Select the Patch you want to modify the message for, and it should automatically change the screen to the MQ editor. 选择您要修改消息的补丁,它将自动将屏幕切换到MQ编辑器。 Edit the message which is in the middle of the screen, then click QRefresh. 编辑屏幕中间的消息,然后单击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. 最后,右键单击补丁,然后选择“修改历史记录”->“完成补丁”,这会将其从补丁转换回变更集。

Oh, this assumes that MQ is an active extension for TortoiseHG on this repository. 哦,这假设MQ是该存储库上TortoiseHG的有效扩展。 If not, you should be able to click File->Settings, click Extensions, and click the mq checkbox. 如果不是,您应该能够单击文件->设置,单击扩展名,然后单击mq复选框。 It should warn you that you have to close TortoiseHg before the extension is active, so close and reopen. 它应该警告您必须在扩展激活前关闭TortoiseHg,因此请关闭并重新打开。


#5楼

Rollback-and-reapply is realy simple solution, but it can help only with the last commit. 回滚和重新应用是非常简单的解决方案,但是它只能在最后一次提交时提供帮助。 Mercurial Queues is much more powerful thing (note that you need to enable Mercurial Queues Extension in order to use "hg q*" commands). Mercurial Queues功能更强大(请注意,您需要启用Mercurial Queues Extension才能使用“ hg q *”命令)。


#6楼

One hack i use if the revision i want to edit is not so old: 如果要编辑的修订版本不太旧,我可以使用一种技巧:

Let's say you're at rev 500 and you want to edit 497. 假设您的转速为500,而您想要编辑497。

hg export -o rev497 497
hg export -o rev498 498
hg export -o rev499 499
hg export -o rev500 500

Edit rev497 file and change the message. 编辑rev497文件并更改消息。 (It's after first lines preceded by "#") (在第一行之后加上“#”)

hg import rev497
hg import rev498
hg import rev499
hg import rev500

如何在Mercurial中编辑错误的提交消息? [重复]相关推荐

  1. 如何在Golang中返回错误?

    In Golang, we return errors explicitly using the return statement. This contrasts with the exception ...

  2. 如何在 Swift 中进行错误处理

    作者:Olivier Halligon,原文链接,原文日期:2015-12-17 译者:JackAlan:校对:靛青K:定稿:Channe 今天的文章讲解如何在 Swift 中进行错误处理. 说实话, ...

  3. html按钮怎么修改大小设置吗,如何在HTML中编辑按钮大小?

    如何在HTML中编辑按钮大小?使用HTML设计按钮之类的东西不是首选的方式.(1999年我开始建网站的时候,我们就是这么做的,但是现在有更好的方法了.) 我假定您不熟悉CSS以及如何将CSS文件导入到 ...

  4. 如何在PowerPoint中编辑页眉和页脚

    Headers and footers in PowerPoint are ideal for displaying descriptive content, such as slide number ...

  5. 如何在Python中注释掉一段代码[重复]

    本文翻译自:How to comment out a block of code in Python [duplicate] This question already has an answer h ...

  6. 如何在Git中更改多次提交的作者和提交者名称以及电子邮件?

    我当时正在学校计算机上编写一个简单的脚本,然后将更改提交到Git(在笔驱动器中的一个回购中,该回购是从家里的计算机中克隆的). 经过几次提交后,我意识到我正在以root用户身份提交东西. 有什么办法可 ...

  7. PHP 如何在Redis中实现事物(事物提交和事物回滚)

    讲了这么多Redis的使用,今天我们来讲下Redis的事物 1.首先,我们来看一下Redis中事物相关的指令, 命令原型       命令描述 MULTI   用于标记事务的开始,其后执行的命令都将被 ...

  8. Java错误提示框口怎么使用_如何在Swing中显示错误消息对话框?

    以下示例展示了如何在基于swing的应用程序中显示错误消息警告. 使用以下API - JOptionPane - 创建标准对话框. JOptionPane.showMessageDialog() - ...

  9. Illustrator 教程:如何在 Illustrator 中编辑画板?

    欢迎观看illustrator教程,小编带大家学习 illustrator 的基本工具和使用技巧,了解如何在 illustrator 使用画板工具和画板面板编辑.复制画板. 创建的画板与 InDesi ...

最新文章

  1. Weka学习五(ROC简介)
  2. version control(版本控制)
  3. 前端学习(1880)vue之电商管理系统电商系统之获取左侧菜单数据
  4. Linux的Qt编译出现:-1: error: cannot find -lGL问题的解决方法
  5. MySQL 对 CREATE TABLE IF NOT EXISTS SELECT 的处理
  6. 软件测试基础知识【归纳】
  7. 【CarMaker学习笔记】申请使用账号
  8. EXCEL【数据处理之数据清洗——缺失数据处理】
  9. 带宽与码元的关系_带宽和传输速率的关系是什么?
  10. Visio设置默认字体大小的方法
  11. 计蒜客 A1596.蒜头君王国 概率计算(dp)
  12. 深度学习|迁移学习|强化学习
  13. c语言cfile用法,CFile和CArchive的使用
  14. 路由器CFE-固件-NVRAM
  15. 《PHP程序员面试笔试宝典》——如何克服面试中紧张的情绪?
  16. 交叉引用跳转不到后面_参考文献的作用与正确引用避免查重
  17. 图的着色问题(二分图)
  18. 杜亥姆—马居耳公式(Duhem-Margule equations)及其应用
  19. 企业微信应用实战踩坑之路
  20. 好消息!PMP项目管理证书列入急需紧缺专业人才人员

热门文章

  1. 购物中心客流统计的应用
  2. [渗透测试学习靶机02] vulnhub靶场 Empire: Breakout
  3. 车辆运动控制(4)考虑道路曲率和轮胎滑移
  4. 对java后端的一些学习建议
  5. 7s巡检管理系统是什么_基于微信的巡检系统7S巡检管理系统
  6. 大三寒假实习了半个月很困惑
  7. 试用微软 必应输入法 功能简洁
  8. IT系统管理员的节日
  9. python psutil下载安装_windows 利用pip 安装python psutil 模块
  10. 01熵与热力学重要模型