11

From Mercurial FAQ page I read how to discard all local changes of my repo.

hg update -C -r

But what I want is to discard local changes in particular file and/or a group of files separated by space/comma. I tried following command but why this is not working?

hg update relative/path/to/my/file.rb

1 Answer 1

18

You can use revert

hg revert --no-backup file.rb

As of Mercurial 2.0, you can use

hg revert -C file.rb

to prevent the creation of .orig files.

4
  • what does -C mean here?
    – Umair A.
    Commented Sep 17, 2013 at 10:12
  • I think it means 'clean'. It does the same as '--no-backup' and saves you some typing.
    – shamp00
    Commented Sep 17, 2013 at 10:15
  • Actually i only tried hg revert "File Name" and it created .orig file, now i am looking for solution to remove .orig file. Trying hg remove "File Name with .orig" extension is not removing the file. Commented Sep 1, 2015 at 12:07
  • Just delete the .orig file.
    – shamp00
    Commented Sep 1, 2015 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.