android - How to ignore a folder except one subfolder in Mercurial
问题描述
I'm using Mercurial and I would like to ignore all folders named 'build' (I have two of these), with one exception - I would like to include the folder 'build/outputs/mapping/release'
I tried to add 'build/*' to .hgignore and manually add the subfolder to my repository it using hg add build/outputs/mapping/release but it didn't work.
Any idea how can I do it in my .hgignore file?
解决方案
Git 支持“取消忽略”之前列出的忽略条目的概念,后面的条目会覆盖之前的条目。Mercurial 没有,因此您必须想出涵盖您的情况的表达式。
您提到您有两个特定的目录要忽略,因此您可以简单地列出它们,而不是使用模式:
^build/ignore1/
^build/ignore2/
例如。对于更复杂的情况,您可以将它们全部枚举,或者提出与所需路径匹配的模式,就像您在评论中所做的那样。
推荐阅读
- c# - Chain When 子句使用 SqlKata
- android - 如何跟踪用户为 PagedListAdapter 中的每个项目所做的每个 API 调用的状态?
- vue.js - Vuex——全球处理网络繁忙状态?
- amazon-web-services - 您如何将 API 网关指向 CDK 中的 lambda 别名?
- php - 用正则表达式替换 PHP 代码
- sql - 返回不同的行,同时从不同的列中排除一列
- javascript - Moment.js 为字符串输入添加时间
- postgresql - 如何编写一个 postgresql 函数来汇总每日报告表中的分组指标
- c# - 如何合并列表
GroupBy() 中的字段 - reactjs - 如何断言包装在 debounce 中的函数被调用