Mercurial:如何忽略对跟踪文件的更改 [英] Mercurial: How to ignore changes to a tracked file

查看:46
本文介绍了Mercurial:如何忽略对跟踪文件的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中有一个带有数据库设置的文件,我已将其设置为一些默认值.该文件由Mercurial跟踪并签入.由于将使用不同的开发人员机器使用不同的值来编辑此文件,所以有没有办法让我告诉Mercurial忽略对该文件的新更改?

我尝试将文件添加到.hgignore文件,但是由于该文件已被跟踪,因此不会被忽略.这在其他情况下也很好,但是我想知道是否可以在这里做些什么?

解决方案

使用文件模板绝对是最好的解决方案. 例如,如果您有一个database.ini文件,则提交一个database.ini.template文件,并忽略.hgignore

中的database.ini.

I have a file with database settings in my project which I have set to some defaults. The file is tracked by Mercurial and checked in. Since this file will be edited with different values various developer machines, is there a way I can tell Mercurial to ignore new changes to this file?

I tried adding the file to the .hgignore file, but since the file is tracked it isn't ignored. This is alright and good in other situations, but I am wondering if there is something I can do here?

解决方案

Using a file template is definitely the best solution. For example, if you have a database.ini file, commit a database.ini.template file and ignore database.ini in .hgignore

这篇关于Mercurial:如何忽略对跟踪文件的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆