I've tracked files I no longer want to track. So I've updated .hgignore
but that doesn't result in them being forgotten. Other than manually hg forget
each do I have other options?
Asked
Active
Viewed 1,044 times
4

Martin Geisler
- 72,968
- 25
- 171
- 229

simpatico
- 10,709
- 20
- 81
- 126
2 Answers
7
With Mercurial 2.0, you can specify a fileset for this! To forget the ignored files, use:
$ hg forget "set:hgignore() and not ignored()"

Martin Geisler
- 72,968
- 25
- 171
- 229
-
Thanks! That was fast and easy. – sholsinger Jan 31 '12 at 20:44
-
Won't pushes and pulls from this repo to another schedule those files for deletion? Or will the ignore file kick in and keep this from happening? – Erik Reppen Apr 10 '13 at 21:03
-
@ErikReppen: A forgotten file is like a removed file, except that it is left behind in *your* working copy. So you're correct that `hg update` in another repository will remove these ignored files from the working copy. The ignore file only serves to cleanup the output from `hg status`, it doens't affect `hg update`. – Martin Geisler Apr 11 '13 at 08:13
-
Experimented last night and it doesn't appear to remove on a pull if it's in an ignore file. I think the idea is that the remove also removes it from tracking which allows the ignore file to do its thing. I don't get it. This effectively "untracks" for purposes of interaction with other repos. Why allow tracking status to overrule explicitly listed ignore file status? Having to add to an ignore file and then forget actually being a delete operation where the changesets are concerned has lead to more confusion on our team than it saved. I'll go bug them on... whatever hub they're on. – Erik Reppen Apr 11 '13 at 14:56
-
Please see [this answer](http://stackoverflow.com/a/9930217/110204) or [this answer](http://stackoverflow.com/a/12050113/110204). They should clear it up! – Martin Geisler Apr 11 '13 at 15:02
1
I dont think there is another option.
You have already checked these files into
Mercurial.After hg forget
the .hgignore file will take effect
and prevent them from being added again. More precisely, the .hgignore
file will make hg status
stop showing the files as untracked
Tracked files are never affected by the .hgignore
file. Well hg addremove
could help you. Take a look here.

Martin Geisler
- 72,968
- 25
- 171
- 229

bilash.saha
- 7,226
- 2
- 35
- 40