Mercurial汞忽略无法正常工作 [英] Mercurial hg ignore does not work properly
问题描述
情况
$ cat .hgignore
.hgignore
$ hg status
M file1
M file2
M src/project.xml
我不想跟踪project.xml
,所以我运行
I don't want to track the project.xml
so I run
echo "project.xml" >> .hgignore
结果是
$ cat .hgignore
.hgignore
project.xml
$ hg status
M .hgignore
M file1
M file2
M src/project.xml
因此,即使不应该跟踪.hgignore
,现在也对其进行了修改,并且project.xml
没有任何反应.这是什么意思?
So the .hgignore
is now as modified even though it shouldn't be tracked and nothing happend with the project.xml
. What does this mean?
推荐答案
您写道:
" M src/project.xml"
"M src/project.xml"
表示src/project.xml
受版本控制.
已经受版本控制的文件不能忽略!这
.hgignore
文件用于忽略未跟踪的文件(状态
将会显示一个"?").
which means that src/project.xml
is under version control.
A file already under version control cannot be ignored! The
.hgignore
file is for ignoring files that are untracked (status
will show a "?").
您有两种解决方案来忽略文件:
You have two solutions to ignore your file:
- 您可以"
hg forget
"文件(与"hg add
"相反)(即, 告诉Mercurial不再跟踪此文件),或者 -
您可以将"
-X
"选项用作status/diff/commit
的默认选项 在您的.hg/hgrc
配置文件中,例如
- You can either "
hg forget
" the file, the opposite of "hg add
" (i.e., telling Mercurial not to track this file anymore), or You can use the "
-X
" option as a default forstatus/diff/commit
in your.hg/hgrc
configuration file, e.g.,
[默认值]
状态= -X <file>
差异= -X <file>
commit = -X <file>
[defaults]
status = -X <file>
diff = -X <file>
commit = -X <file>
这将告诉hg不要在status,diff和commit的使用中包括此文件.
which will tell hg not to include this file in the use of status, diff, and commit.
这篇关于Mercurial汞忽略无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!