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

In my repository, library / database.php there is a specific file that I need to ignore. However, I cannot get the syntax to recognize the file - I tried **/libraries/**/database.php and libraries/database.php in glob and ^.libraries/database.php in regex, but none of them work. What should I do?

+4
source share
3 answers
 syntax: re ^libraries/database\.php$ 

This will work.

But to be honest, I always found the .hgignore syntax a bit obscure. I really don’t understand which globe will and will not correspond.

+4
source

A few hours after all the suggestions here and others found on the Internet, I found out that I always did this correctly .hgignore, but .hgignore will not ignore files that are currently being tracked using mercurial.

You have to do

 hg forget mydir/myfile.ext 

Or adding a file to .hgignore is not affected.

 syntax: glob mydir/myfile.ext 

Then the above will work.

+6
source

From the Mercury Quick Start Guide :

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

is your .hgignore in the right place?

So,

 syntax: glob libraries/database.php 

must work.

+1
source

All Articles