简体   繁体   中英

How to ignore some folders in HG?

Starting here , I'm wrestling with this right now. I've got two folders: Source and SQL. Source has multiple project folders. The project folders in Source and SQL have bin folders. I want to ignore all files in bin folders under Source, but not under SQL. I thought one of these might do the trick:

glob:Source\*\bin\
glob:Source\*\bin
glob:Source\*\bin\*
glob:Source\*\bin*
glob:Source*\bin\
glob:Source\*bin\

But no dice on all of the above.

It seems I'll have to enter a line for each folder under Source where I expect to have a bin folder (and then update my .hgignore file whenever I add a new project).

glob:Source\Project1\bin\
glob:Source\Project2\bin\
#etc

If this is not the case, any advice would be appreciated.

Have you tried a regexp:

syntax: regex
^Source/.*/bin

Also, do remember that anything you've already added isn't affected by ignore rules, so you need the files to be untracked to test this stuff.

Lastly, consider making each project a separate repo -- that's the standard advice in DVCS land be it Mercurial or git. In svn multiple projects in the same repo isn't such a bad idea because you can have different parts of the working directory updated to different revisions, but with a DVCS all files are updated/checkedout to the same revision, which makes putting multiple Projects in the same repo a hassle in general and a really bad idea in some circumstances.

Looking at my .hgignore file, my slashes seem to to be the other way around (a forwrad slash instead of a backslash). ie:

glob:*/bin/*

Try that maybe?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM