3

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.

Community
  • 1
  • 1
Faramir
  • 105
  • 4
  • If you're afraid of losing changes, just clone your local repository. Then you have all your original commits saved. Keep that, create new clones from it (if you mess up) and delete it once you've pushed the correct versions of your commits. (Local clones are space efficient as they use hardlinks on most modern filesystems). – Macke Mar 16 '11 at 15:27

2 Answers2

4

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.

Dan
  • 3,665
  • 1
  • 31
  • 39
3

You might want to look at the HistEditExtension which helps with editing a whole bunch of commits (renaming, changing files, combining, dropping, etc.)

Also, it usually doesn't matter that much what version the server uses. It's more about what you're using locally.

Macke
  • 24,812
  • 7
  • 82
  • 118
  • my "local" environment is sshing into the server – Faramir Mar 16 '11 at 15:00
  • Ok, so either install a slightly newer hg version (1.3+) in your local account, or make a second clone at your desktop computer (or somewhere else) where you can install histedit and run it. I think it's your best option since there are several commits _and_ you're not using mq. – Macke Mar 16 '11 at 15:25