How to undo all added files in Mercurial
Preface
You must always ask questions, which contain as much information as possible. Because now your question, depending from some conditions, may have totally different answers.
Case One - no local modifications in already versioned files, only added (and not committed) files
hg revert
will return your working directory to the state after the last commit, undoing all changes it it.
Case One - local edits, which you want to save and occasionally added files
- Read about filesets in Mercurial.
- Use fileset in the
hg forget
command, something likehg forget "set:added()"
.
Use hg revert
or hg forget
on the files (both do the same for a file you ran hg add
on). To avoid typing out the filenames, you can use a fileset like this:
$ hg revert "set:added()"
This will revert the file back to how it looked in the working copy parent revision, i.e., it will become unknown again.