你如何管理你的忽视?

发布于 2024-11-23 23:28:50 字数 622 浏览 2 评论 0原文

为了停止为每个新存储库编写我的 .hgignore ;我决定为我的 hgignores 创建一个单独的存储库,当前看起来像:

hgignores    
├── cpp
├── eclipse
├── intellij
├── java
├── latex
├── linux
├── netbeans
├── osx
├── python
└── textmate

现在,对于每个存储库,我正在粘贴相关的忽略。

例如:

$ cat hgignores/latex hgignores/osx hgignores/textmate >> [repo]/.hgignore

这让我想知道,如果将来我碰巧忘记了 cpp 的忽略文件的标志(例如),我将不得不编辑 hgignores/cpp 并最终再次对我拥有的每个 cpp 存储库进行更改!

我认为通过为忽略创建统一的存储库,我正在朝着正确的方向前进,但我可能在这里或那里遗漏了一些提示。

很想听听一些建议;或对如何完成这件事的见解?

In order to stop writing my .hgignore for every new repository; I decided to create a separate repository for my hgignores which currently looks like:

hgignores    
├── cpp
├── eclipse
├── intellij
├── java
├── latex
├── linux
├── netbeans
├── osx
├── python
└── textmate

Now for each repository, I am pasting the relevant ignores.

For example:

$ cat hgignores/latex hgignores/osx hgignores/textmate >> [repo]/.hgignore

This makes me wonder, if in the future I happen to have forgotten a flag for an ignore file for cpp (for example), I will have to edit hgignores/cpp and eventually make changes in every cpp repository I have AGAIN!

I think I am moving to a right direction by creating a unified repo for ignores, but I maybe missing few tips here and there.

Would love to hear some suggestions; or insights into how you get this done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绝不放开 2024-11-30 23:28:50

您可以使用 Mercurial 的存储库的 hgrc指向忽略文件 存储库外部:

[ui]
ignore = /path/to/ignorefile
ignore.cpp = /path/to/cppignorefile

您也可以在全局 hgrc/Mercurial.ini 中执行此操作,但如果需要,请记住这一点有一天。

当然,这部分必须重新添加到存储库的新克隆中,因为 hgrc 未被克隆。

You can use the Mercurial's repo's hgrc to point to ignore files outside of the repository:

[ui]
ignore = /path/to/ignorefile
ignore.cpp = /path/to/cppignorefile

You can also do this in your global hgrc/Mercurial.ini, but that's simply something to keep in mind if you need it someday.

Of course, this section would have to be re-added to new clones of a repo, since the hgrc is not cloned.

内心激荡 2024-11-30 23:28:50

我倾向于将有关我的个人工具的所有忽略模式放入我的全局忽略文件中(gitmercurial):文本编辑器、操作系统等。从事该项目的其他人有不关心这些,所以我保留将它们从项目的忽略文件中删除。
这是一些您不必在每个项目上管理的忽略模式。

关于项目特定的忽略,拥有模板文件似乎就足够了。每种语言所需的模式不会经常改变(对于大多数语言来说可能永远不会改变)。您仍然可以在忽略存储库中编写一个小脚本来更新忽略文件。它只会导入缺失的模式。

I tend to put all the ignore patterns regarding my personal tools in my global ignore file (git, mercurial): text editor, operating system, etc. Other people working on the project are not concerned by these, so I keep them out of the projects' ignore files.
That's a few ignore patterns you won't have to manage on each project.

Regarding project specific ignores, having template files seems good enough. The patterns needed per language won't change frequently (probably never for most of them). You can still write a small script in your ignores repository to update your ignore file. It would import missing patterns only.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文