忽略对存储库中已有文件的更改 [英] Ignore changes to files that are already in repository

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

问题描述

将文件添加到 .hgignore 将阻止它们被跟踪.但是我们有一些文件想要放在存储库中 - 我们只是不希望用户提交更改.有没有办法忽略对这些文件的更改,这样它们就不会在 hg commit 中提交.

Adding files to .hgignore will prevent them from being tracked. But we have some files that we want to be in the repository - we just don't want users to ever commit changes. Is there a way to ignore changes to these files, so they won't get committed in an hg commit.

推荐答案

这不能在 Mercurial 中完成——文件要么被跟踪,要么未被跟踪(然后可以选择忽略).您应该改为对模板文件进行版本控制,然后忽略实际文件.

That cannot be done in Mercurial — a file is either tracked or untracked (and then optionally ignored). You should instead version a template file and then ignore the real file.

因此将config.template 添加到版本控制并将config 添加到.hgignore.请您的开发人员将模板复制到真实姓名中,并根据需要进行自定义.

So add config.template to version control and add config to .hgignore. Ask your developers to copy the template to the real name and customize it as needed.

这篇关于忽略对存储库中已有文件的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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