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

3

11

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?

Barragan answered 8/6, 2011 at 17:58 Comment(0)
L
18

Can't you just do this:

hg add packages/repositories.config

And then have this in your .hgignore file

syntax: glob

packages

?

Lashawn answered 8/6, 2011 at 18:59 Comment(3)
The obvious is always hidden from sight. Thank youBarragan
Does that not ignore any subsequent changes to repositories.config?Aegis
@MattHamilton it doesn't ignore subsequent changes. .hgignore is only about not showing unadded files. Once a file has been added the .hgignore has no effect at all.Wholesale
N
3
syntax: regexp
packages/(?!repositories.config).*

[source]

Necessarily answered 17/4, 2013 at 22:0 Comment(0)
P
0

For ignore all jpg files with subdirectories in folder images:

^images/.*\.jpg$
Pimentel answered 13/1, 2015 at 18:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.