1

Possible Duplicate:
Using mercurial, what's the easiest way to commit and push a single file while leaving other modifications alone?
Check in single file with Mercurial?

I made changes to 2 files. One has a bug fix, the other has a bunch of temporary debugging code that I want to keep in my working directory for now but do not want to commit.

With git I would only add the first file to the changeset, how do I easiest do this with mercurial?

Community
  • 1
  • 1
George Mauer
  • 110,852
  • 124
  • 360
  • 595

2 Answers2

3

Can you not simply commit the one file that you do want:

hg commit filename

Alternatively, you could use the -X option to exlude the other file:

hg commit -X filename2

Since you only have 2 files, one which should be commited and one which should not, it doesn't really make a difference either way.

See the documentation for more information.

James Allardice
  • 160,885
  • 21
  • 326
  • 309
2

Just use

$ hg commit your-file

You might also find the record extension interesting: it let's you commit only part of the changes made in a file.

Martin Geisler
  • 71,485
  • 25
  • 165
  • 226