开发者

Having Mercurial ignore everything except certain subdirectories

开发者 https://www.devze.com 2023-01-26 12:06 出处:网络
Through searching I\'ve found how to have Mercurial ignore certain directories (and the files/directories they contain) that are in the root of the repository directory, but I can\'t work out how to e

Through searching I've found how to have Mercurial ignore certain directories (and the files/directories they contain) that are in the root of the repository directory, but I can't work out how to extend this to directories that are several levels in.

In this case, I wish to only version control the following directories:

app/desig开发者_Go百科n/frontend/rc
skin/frontend/rc

As a result, my .hgignore file looks like this.

syntax=regexp
^(?!(app(/|$))|(skin(/|$)))
^app/code
^app/design/adminhtml
^app/design/frontend/base
^app/design/frontend/default
^app/design/install
^app/etc
^app/locale
^app/Mage.php
^app/.htaccess
^skin/adminhtml
^skin/frontend/base
^skin/frontend/default
^skin/install

I'm sure there's a much better way of doing it that doesn't involve picking out the other directories within app and skin, and as I'll probably want to do this for a few projects I thought I'd ask here. Thanks.


Manually add the directories that you want to your repository, then ignore everything else.

hg init
hg add app/design/frontend/rc
hg add skin/frontend/rc

Then in your .hgignore:

syntax: glob

**
0

精彩评论

暂无评论...
验证码 换一张
取 消