git .gitignore 中的评论?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8865848/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:44:49  来源:igfitidea点击:

Comments in .gitignore?

gitcommentsgitignore

提问by James Raitsev

Can you write comments in a .gitignorefile?

你能在.gitignore文件中写注释吗?

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

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

回答by TimWolla

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

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

cf. http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files

参见 http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files

The rules for the patterns you can put in the .gitignore file are as follows:
- Blank lines or lines starting with # are ignored.
[…]

您可以放入 .gitignore 文件的模式规则如下:
- 忽略空行或以 # 开头的行。
[…]

The comment character is #, example:

注释字符是#,例如:

# no .a files
*.a

回答by manojlds

Do git help gitignore

git help gitignore

You will get the help page with following line:

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

A line starting with # serves as a comment.