Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hgignore all subfolders but not the file in a folder?

I am looking to use nuget without committing the packages. I want to ignore in mercurial all packages subfolder that are located in the /packages/ folder, but I do not want to exclude the repositories.config file located in the /packages/ folder.

How should I write the exclusion regex to do that?

like image 239
Pierre-Alain Vigeant Avatar asked Jun 08 '11 17:06

Pierre-Alain Vigeant


2 Answers

Can't you just do this:

hg add packages/repositories.config

And then have this in your .hgignore file

syntax: glob

packages

?

like image 133
Julio Gorgé Avatar answered Nov 04 '22 21:11

Julio Gorgé


syntax: regexp
packages/(?!repositories.config).*

[source]

like image 3
Chris Romp Avatar answered Nov 04 '22 21:11

Chris Romp