开发者

Mercurial .hgignore: Some questions on how to ignore a single file

There's a particular file in my repository, libraries/database.php, that I need ignored. However, I can't get the syntax to recognize the file 开发者_运维技巧- I've tried **/libraries/**/database.php and libraries/database.php in glob, and ^.libraries/database.php in regex, but neither of them work. What should I do?


After hours of following all the suggestions here and others found on the web, I found out that I was always doing it right in .hgignore, but .hgignore will not ignore files that are currently being tracked by mercurial.

You must do

hg forget mydir/myfile.ext

Or adding the file to .hgignore doesn't take affect.

syntax: glob
mydir/myfile.ext

Then the above will work.


syntax: re
^libraries/database\.php$

That will work.

But, frankly, I've always found the .hgignore syntax to be a little obscure myself. I don't really understand what glob will and won't match.


From the mercurial QuickStart guide:

"Mercurial will look for a file named .hgignore in the root of your repository which contains a set of glob patterns and regular expressions to ignore in file paths"

is your .hgignore at the right place ?

So

syntax: glob
libraries/database.php

should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜