在Mercurial中是否有“提交时忽略"选项? [英] Is there an ignore-on-commit option in mercurial?

查看:48
本文介绍了在Mercurial中是否有“提交时忽略"选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法可以忽略带有Mercurial的提交中的某些文件的更改?

Is there any way to ignore changes to some files on a commit with mercurial?

我有一个特定的情况,我们有一个默认的oracle tnsnames.ora文件指向127.0.0.1,但是一些开发人员会对其进行修改以指向其他系统,但是我们不想更改该默认文件.

I've got a specific situation where we have a default oracle tnsnames.ora file that points to 127.0.0.1, but some developers will modify it to point to other systems, but we don't want to change the default file.

在Subversion中,我已将其简单地添加到提交时忽略"更改列表中.有没有办法做到这一点?

In subversion, I've simple added this to the ignore-on-commit changelist. Is there a way of doing this in mercurial?

推荐答案

如果要从"hg commit"命令中忽略的文件已被跟踪",则应使用-X选项.传递给-X的模式非常灵活,例如可以运行:

If the files you want to omit from the "hg commit" command are already "tracked", you should use the -X option. The pattern passed to -X is pretty flexible, making it possible to run for example:

% hg stat
A etc/foo.conf
M src/bar.c
M lib/libbar/loader.c
% hg commit -X '**.conf'

避免提交任何扩展名为".conf"的文件,而不管其在源代码树中的深度.在上面显示的工作空间中,这将提交"src/bar.c"和"lib/libbar/loader.c",但不会提交"etc/foo.conf".

to avoid committing any file with a ".conf" extension, regardless of how deep in the source tree it lives. In the workspace shown above this would commit "src/bar.c" and "lib/libbar/loader.c" but not "etc/foo.conf".

要排除文件名的多种模式,请使用多个-X选项,即:

To exclude multiple patterns of filenames, use multiple -X options, i.e.:

% hg commit -X '**.conf' -X '**.sh'

这篇关于在Mercurial中是否有“提交时忽略"选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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