Many times I'm making two different changes to files in my repository, I want those changes to be treated as two consecutive commits.
For example, in repository
While fixing a bug prog.c
and prog.h
, I fixed a typo in README.txt
. Now I want to commit the change to prog.c
with its own commit message, and the change to README.txt
afterwards.
In git, I could easily do that with the index
git add prog.c prog.h
git commit -m 'bug #1234'
git commit README.txt -m 'some typos fixed'
What's the best way to do that in Mercurial?
Clarification: I used (before the edit) a toy example where each changeset spans over a single file. But I want the general answer, what should I do when there are many files in each changeset.
hg commit -m "bug #1234" prog.c prog.h
then
hg commit -m "some typos fixed" README.txt
I LOVE the crecord mercurial extension for this purpose: it gives me file by file (and chunk by chunk, and line by line) control over what exactly I want in this commit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With