如何在Mercurial中编辑错误的提交消息? [英] How to edit incorrect commit message in Mercurial?

查看:98
本文介绍了如何在Mercurial中编辑错误的提交消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用TortoiseHg(Mercurial),并意外提交了错误的提交消息.我该如何在存储库中编辑此提交消息?

I am currently using TortoiseHg (Mercurial) and accidentally committed an incorrect commit message. How do I go about editing this commit message in the repository?

推荐答案

更新:Mercurial已添加--amend,该目录应为

Update: Mercurial has added --amend which should be the preferred option now.

您可以使用hg rollback回滚最后一次提交(但仅最后一次提交),然后重新应用它.

You can rollback the last commit (but only the last one) with hg rollback and then reapply it.

重要:此永久删除最新的提交(或拉取).因此,如果您已完成hg update提交,该提交不再位于您的工作目录中,那么它将永远消失. 所以请先复制一份.

Important: this permanently removes the latest commit (or pull). So if you've done a hg update that commit is no longer in your working directory then it's gone forever. So make a copy first.

除此之外,您无法更改存储库的历史记录(包括提交消息),因为其中的所有内容都是校验和.您唯一可以做的就是在给定的变更集后修剪历史记录,然后相应地重新创建它.

Other than that, you cannot change the repository's history (including commit messages), because everything in there is check-summed. The only thing you could do is prune the history after a given changeset, and then recreate it accordingly.

如果您已经发布了更改(除非您可以保留所有副本),并且您也无法重写历史记录"(包括由其他人进行的GPG签名的提交),那么这些都不起作用.

None of this will work if you have already published your changes (unless you can get hold of all copies), and you also cannot "rewrite history" that include GPG-signed commits (by other people).

这篇关于如何在Mercurial中编辑错误的提交消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆