I have an uncommitted changeset. I want to commit some of the changes, but not commit some of the files (like unstaging a file in git). Can this be done in mercurial?
To unstage commits on Git, use the “git reset” command with the “–soft” option and specify the commit hash. Alternatively, if you want to unstage your last commit, you can the “HEAD” notation in order to revert it easily. Using the “–soft” argument, changes are kept in your working directory and index.
Add the Mercurial Extension called purge. It is distributed by Mercurial. It is not enabled by default, maybe to avoid accidentally removing files that you forgot to add. Save this answer.
To revert a file to a specific changeset, use hg revert -r CHANGESET FILENAME . This will revert the file without committing it.
Use the -X
option to hg commit
to exclude certain files. You can specify it more than once on the command line. For example,
hg commit -X path/to/unwanted/file -X path/to/another/file
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