mercurial Common operations Using the revert command to discard unwanted changes.


Example

The revert command allows discarding unwanted uncommitted changes.

  • Reverting changes to a single file.
hg revert example.c
  • Reverting all changes.

This will discard all changes not just the current directory.

hg revert --all

hg will output which files were reverted.

reverting example.c

reverting mydir\example.cpp

forgetting file.txt

Backup files are produced for discarded changes to previously committed files, in the form filename.orig