Search code examples
version-controlmercurialmercurial-queue

Mercurial: qrefresh to edit several commit messages?


I've come across these questions: Incorrect Commit Message In Mercurial and Is qrefresh harmful. However, I'm still confused about my specific problem.

I cloned a repository and have since made about 10 commits. Before pushing, I realized that I should have included a certain phrase in each commit I made. So basically I need to edit the commit message for my last 10 commits to fix this. qrefresh has been mentioned, but in a confusing way that makes me worry about losing data. I'm still a very basic Mercurial user so it would be helpful if someone could help me out with detailed instructions so I don't lose anything.

Also, the server I'm using is running Mercurial 1.0.1 (I know it's old!)

EDIT:

I've come across the answer I needed in another question as one of its answers. It worked, but I also think it's necessary to read up on MQ to really understand what is going on.


Solution

  • The qrefresh command is only useful if you are using Mercurial Queues. You say that you're still a Hg newbie so I assume you're not. But yes, if you were using queues, the current patch's commit message can be edited with the following command:

    hg qrefresh -e "new commit message"

    Again, Mercurial Queues (or MQ) is an advanced topic and I'd advise you read up on it here

    MQ is powerful, but until you're comfortable with them, HistEdit is a good way to go, as Macke has mentioned.