Search code examples
mercurial

Ignore future changes to a file in Mercurial, but still track it


Possible Duplicate:
Mercurial: How to ignore changes to a tracked file

I have a file in a Mercurial repository that I want to have stand as an example configuration file, but while I'm developing it I want to make specific changes to it I don't want tracked, like a database password. I tried adding that file to .hgignore, but Mercurial still notices modifications.

Can I have a file "tracked" in a Mercurial repository, yet ignore future local changes to that file without removing it from the repository itself?


Solution

  • I don't think this capability exists (love to see someone else's answer with an option though :) ). The alternative I've used is to check a file into source control named "config.template" (as an example). The app actually uses a file named "config", which I then create by copying the template file. Then make sure that the "config" file is excluded in the .hgignore file so you don't accidentally check in sometime.