Edit Mercurial Previous Post - TortoiseHg

Is there a way to edit the commit message in Mercurial when commit after other transactions have occurred using TortoiseHg? I read these posts:

How to edit an invalid commit message in Mercurial?

Mercurial: how to amend last commit?

and were able to update the “regular” commit message when it is the last commit on the branch (using TortoiseHg). However, I was not able to figure out how to edit the commit message when other commits occurred after the one I want to change. He always edits the last commit.

Based on Ed Cottrell's comment, I checked where I made two commits without clicking on the central repo, and I still have the same problem - only the last commit message can be edited.

EDIT: I have to clarify that I want to update the changeset that was clicked.

+8
mercurial commit message tortoisehg
source share
3 answers

The Histedit extension (bundled with TortoiseHG now) has a mess command to modify the commit message of historical change sets.

Unfortunately, this command is not supported by the TortoiseHG GUI, so you need to run the command from the command line.

+9
source share

As long as the change in the question is local and is not being pushed anywhere, perhaps.

The commit message is used to compute a globally unique hash identifier that is used by all repositories to determine if they already have a set of changes. If you change the commit message, you will change the unique hash identifier and each repo will see it as a “new” set of changes. All other repositories in which there was an old set of changes will try to get a new one and ask that you merge it with yourself ... This is not good, so the short answer to your question is “do not do this”.

If you can permanently clear this change from all other repositories so that only the local copy remains, you could, in fact, switch to the “design” state. Please note that if any repo has an “old” set of changes, it will someday be transferred to the central repo and cause a mess that we are trying to avoid.


If the change set is still local (for example, in draft status), you can use hg commit --amend if it is the parent of the working directory.

If changes happen after it, I would use mq and hg qimport all the changes up to and where you want to edit the commit message. hg qpop -a and then hg qpush to go to the patch, which represents the set of changes you want to edit. Then hg qrefresh -e and make the change. Then just hg qfin -a , and you should be good to go.

+3
source share

Edward's advice is good - if you moved your changes to another repository, you should consider that they are installed in the stone, and not update the commit message or some other aspect.

However, we are working on changing this in Mercurial. There is an experimental extension that will allow you to do more extensive history editing and make these changes to other repositories. It is called the Evolve Extension , and it allows some behavior to partially reside in the Mercurial core and partially in the external core.

When using evolution, you can edit the message from the second to the last commit, like this

 $ hg update .^ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg commit --amend -m 'new commit message' 1 new unstable changesets $ hg stabilize more:[5] old tip changeset atop:[6] new commit message 

An extension allows you to do this while changes are in the design phase. To keep them in the project stage after they clicked them somewhere, the repository that you click on must be configured as a non-publisher repository. Learn more about this in the Evolution Documentation Update .

+3
source share

All Articles