Umair A.
Umair A.

Reputation: 6863

Mercurial discard local changes of a file or group of files or all

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

Upvotes: 11

Views: 13350

Answers (1)

shamp00
shamp00

Reputation: 11326

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.

Upvotes: 18

Related Questions