I have an uncommitted set of changes. I want to commit some changes, but not commit some files (e.g. uninstall the file in git). Can this be done in mercurial?
Use the -X option for hg commit to exclude specific files. You can specify it more than once on the command line. For example,
-X
hg commit
hg commit -X path/to/unwanted/file -X path/to/another/file
You can pass a list of files to commit to hg commit , for example. hg commit -m msg file1 file2 ...
hg commit -m msg file1 file2 ...
Oops! You have two options.
Commit only some files.
If you specify file names as arguments to hg commit , only those files will be committed. Therefore, if I have the following hg status :
hg status
M foo.txt M bar.txt
I can run hg commit foo.txt to commit the changes to foo.txt and leave the changes to bar.txt for later commit.
hg commit foo.txt
foo.txt
bar.txt
Use the record extension.
record
A write extension gives Mercurial behavior for the git index, allowing you to commit only some fixes to your changes (e.g. git add --patch ). See the docs for more details.
git add --patch