Gitignore文件可以有名字吗?

发布于 2025-01-29 05:35:59 字数 129 浏览 4 评论 0原文

例如,您可以命名.gitignore文件foo.gitignore吗?

最终,目的是拥有多个.gitignore用于不同的子项目类型的文件。

For example, can you name a .gitignore file foo.gitignore?

Ultimately, the purpose for this being to have multiple .gitignore files for different sub-project types.

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

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

发布评论

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

评论(2

空气里的味道 2025-02-05 05:35:59

简短答案:不,不是本地。

i content-filter驱动程序,结帐时,它将自动修改.gitignore使用其他文件的内容(例如foo.gitignore)。

但是,这需要本地设置激活该驱动程序

git config filter.gitignore.smudge 'script_to_modify_gitignore'

的含义:当您克隆存储库时,该机制将不会立即处于活动状态,而不是没有手册git config sptep。

Short answer: no, not natively.

I suggested before a content-filter driver which, on checkout, would automatically modify a .gitignore with the content of other files (like a foo.gitignore).

However, that require a local setting to activate that driver

git config filter.gitignore.smudge 'script_to_modify_gitignore'

Meaning: when you clone the repository, that mechanism would not be immediately active, not without the manual git config step.

悲歌长辞 2025-02-05 05:35:59

不,不能。好吧,更确切地说,它可以具有 a 名称,但是该名称始终是.gitignore

(请注意,您也可以将条目存储在.git/info/dublude中,但这绝不是跟踪的文件,也不是投入。)

No, it can't. Well, more precisely, it can have a name, but that name is always .gitignore.

(Note that you can store entries in .git/info/exclude as well, but that is never a tracked file and does not get committed.)

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