Way to include one .hgignore file in another
Asked Answered
R

2

5

Is there any way to include one .hgignore file in another?

e.g., say I have a common .hgignore file in a Mercurial subrepository (named hg-common) that ignores files like desktop.ini & .DS_Store, and I want to include that file in every project that I create. In my .hgignore of my project1 repo, I want to do something like:

syntax: include hg-common/.hgignore

with syntax: include being my imaginary syntax for including the specified file.

Ravage answered 26/5, 2018 at 17:52 Comment(0)
R
3

I found the correct syntax:

include:hg-common/.hgignore
Ravage answered 27/5, 2018 at 9:35 Comment(2)
Why not use ~/.hgignore_global?Compony
@Compony because, I want the ignores in a subrepo to force all users of the repo to ignore the same files.Ravage
T
3

You can use either include or subinclude:

include:hg-common/.hgignore
subinclude:hg-common/.hgignore

The difference is that subinclude confines its effect to the hg-common directory, whereas include applies the patterns globally.

Tennant answered 7/7, 2022 at 16:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.