16

I've got some files in a repo that I don't want tracked, is it possible to remove them without removing the actual files from the filesystem?

This would be equivalent to git's rm --cached.

ghickman
  • 385

4 Answers4

16

You can use hg forget <file> if files have just been added, however if the files have already been committed use hg rm --after <file>.

The help is a bit misleading, it should be hg rm --do-not-touch-the-filesystem.

ghickman
  • 385
tonfa
  • 357
5

It looks like hg forget is what I was looking for according to this.

This will mark a file so that it is no longer tracked after the next commit.

ghickman
  • 385
2

If you need to remove the file from Mercurial history as well, here's a stackoverflow question on how you do this: https://stackoverflow.com/questions/3558365/mercurial-remove-file-from-all-changesets/

jitbit
  • 620
  • 1
  • 7
  • 14
0

I believe you can simply ignore them by placing them in a .hgignore file in the folder.

http://www.selenic.com/mercurial/hgignore.5.html

Paul
  • 4,854