Suppose that I have made some changes in the working directory and accidentally marked several files (that include some of the modified ones) for removal. How do I unmark the files for removal without losing the changes I have made?
There is only one level of rollback, and there is no way to undo a rollback. It will also restore the dirstate at the time of the last transaction, losing any dirstate changes since that time. This command does not alter the working directory.
Revert changes already committed To backout a specific changeset use hg backout -r CHANGESET . This will prompt you directly with a request for the commit message to use in the backout. To revert a file to a specific changeset, use hg revert -r CHANGESET FILENAME . This will revert the file without committing it.
hg revert -r . ^ path-to-file will revert the commit from the commit-set. then commit and submit (if using jelly fish) and you'll see the files removed from the changeset.
hg revert changes the file content only and leaves the working copy parent revision alone.
Just hg add
the files.
I don't know why you're getting some many answers that modify the working directory. If you've accidentally marked some files for removal you can undo it with add.
ry4an@four:~/hgtest$ hg status --all M another_file C a_file ry4an@four:~/hgtest$ hg remove --after --force * ry4an@four:~/hgtest$ hg status --all R a_file R another_file ry4an@four:~/hgtest$ hg add * ry4an@four:~/hgtest$ hg status --all M another_file C a_file
That said, don't use --force
with hg remove
or ever really. Also try to get in the habit of using hg forget
instead of hg remove --after
,
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