In our company, we just started using Mercurial and we are facing the following problem:
We have some files in the remote repository that are changed by each developer to add some local configuration but these files must never be changed in the remote repository.
Is there a way to tell Mercurial to stop tracking those files locally without making any change to the file on the remote repository?
We tried with hg forget <file>
but as I understand, this will remove the file from the remote repository.
We also tried adding those files to .hgignore
file, but somehow the files are not really being ignored, I guess Mercurial does this because the files are already being tracked.
So far, we are just ignoring the files when we perform a commit and we use shelve
to maintain and restore our local changes after an Update, but it's starting to be a really tedious task.
Thanks in advance for any help.
EDIT: Although it didn't completely fix what we wanted to, accepted answer is the best approach. Our problem is probably a result of a bad design.
If the file you want unchanged is, for example,
config.cfg
, check in aconfig_template.cfg
, forgetconfig.cfg
if it is already tracked, and addconfig.cfg
to the ignore list. Then, a build rule can createconfig.cfg
from the template if it does not already exist.A user will then have a starting config.cfg that they can customize without checking it in.