Mercurial discard local changes of a file or group

2020-08-17 17:56发布

问题:

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:

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.



标签: mercurial