In my project's .hgignore
, I want to exclude /static/
(i.e., the static folder at the root of the directory), but not /templates/static/
. How would I configure .hgignore
to allow this?
hg - Ignore directory at root only
You can include syntax: regexp
at the beginning of .hgignore and then use perl regex syntax to root a directory by using ^
. So just ^static
should do the work.
I would change that to
^static/
, otherwise it will ignore all directories whose name starts with static, which may cause confusion down the road. –
Stirps If your
.hgignore
is in glob syntax you can just put syntax: regexp
and syntex: glob
before and after the line ^static/
. Apparently it's allowed to switch between syntaxes. See manpage: "The chosen syntax stays in effect when parsing all patterns that follow, until another syntax is selected." –
Kenn As of Mercurial 4.9, you can use syntax: rootglob
to insert rooted glob patterns.
New rootglob: filename pattern for a glob that is rooted at the root of the repository. See hg help patterns and hg help hgignore for details
© 2022 - 2024 — McMap. All rights reserved.
syntax:regexp
with^/static/.*
? – Leontina.hgignore
. – Kennre:^static/
to ignore the static folder only in your repo root. – Crucifixion