Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 11 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

If you need to remove the file from Mercurial history as well, here's a stackoverflow question on how you do this:

share|improve this answer

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

share|improve this answer
I've ignored them but they're already tracked in the repo and have changes so are showing up. – ghickman Jan 17 '11 at 16:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.