working - Mercurial ignore file




mercurial ignore files in repository (2)

Add the .hgignore file itself to the .hgignore file:

syntax: glob

.hgignore

or, just check the .hgignore file in to your local clone...

https://code.i-harness.com

I'm trying to get Mercurial to ignore a configuration file, but I'm failing to get it working.

I have created a repository on my server with hg init and cloned that repository to my computer. I then want to be able to edit the configurationj file but not commit those changes back to the server.

I have tried creating a .hgignore in the root of my clone, but Mercurial flags the file with a ? and whether I commit it or not it still continues to log my configuration changes.

Am I creating the .hgignore file in the wrong place, does this file need to be commited? Does it need to be created before I init the repository on the server?


Even if you have ignored files, Mercurial will track them once they have been added to the repository.

To remove your config file from the repository, you can use

hg remove -Af file.cfg

This will remove the file from from the repository (once committed) without deleting your local file. See hg help remove However, there is now a delete recorded in the repo, and Mercurial will remove that file when your or anyone else updates across that revision.

You could also rename it and have people copy the master to their local file, but you will need to coordinate updates of the local file.

hg rename file.cfg file.cfg.example




hgignore