如何在 .gitignore 文件中添加注释?

发布于 2024-12-26 21:08:35 字数 80 浏览 2 评论 0原文

您可以在 .gitignore 文件中写入注释吗?

如果是这样,该行前面是否应该带有 # 或其他指示符?

Can you write comments in a .gitignore file?

If so, should the line be preceded with a # or some other indicator?

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

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

发布评论

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

评论(2

不羁少年 2025-01-02 21:08:35

是的,您可以在那里发表评论。然而,它们必须从一行的开头开始。

参见https://git-scm .com/book/id/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring

可以放入 .gitignore 文件中的模式规则如下:

  • 空白行或以 # 开头的行将被忽略。
    [...]

注释字符为#,例如:

# no .a files
*.a

Yes, you may put comments in there. They however must start at the beginning of a line.

cf. https://git-scm.com/book/id/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring

The rules for the patterns you can put in the .gitignore file are as follows:

  • Blank lines or lines starting with # are ignored.
    […]

The comment character is #, example:

# no .a files
*.a
酸甜透明夹心 2025-01-02 21:08:35

执行git help gitignore

您将获得包含以下行的帮助页面:

以 # 开头的行作为注释。

Do git help gitignore.

You will get the help page with following line:

A line starting with # serves as a comment.

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