Comments in .gitignore?

走远了吗. 提交于 2019-11-27 05:02:00

问题


Can you write comments in a .gitignore file?

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


回答1:


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

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



回答2:


Do git help gitignore

You will get the help page with following line:

A line starting with # serves as a comment.


来源:https://stackoverflow.com/questions/8865848/comments-in-gitignore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!