If you want to do manual inspection on the file names, then use the -i/--ignored
flag to status:
$ hg status -i
I ignored file.exe
If you want the file names alone, then use -n/--no-status
to suppress the I
status code printed in front of each filename:
$ hg status -n -i
ignored file.exe
If you need to process the files with xargs
, then use the -0/--print0
flag in addition:
$ hg status -n -0 | xargs -0 touch
That will take care of handling spaces correctly — with using -0
, there is a risk that you'll end up treating ignored file.exe
as two files: ignored
and file.exe
since shells normally split on spaces.
The above commands show you untracked files matching .hgignore
. If you want to solve the related problem of finding tracked files matching .hgignore
, then you need to use a fileset query. That looks like this:
$ hg locate "set:hgignore()"
You can use filesets with all commands that operate on files, so you can for example do:
$ hg forget "set:hgignore()"
to schedule the files found for removal (with a copy left behind in your working copy).