James Raitsev
James Raitsev

Reputation: 96371

How to add a comment in a .gitignore file?

Can you write comments in a .gitignore file?

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

Upvotes: 791

Views: 202345

Answers (2)

TimWolla
TimWolla

Reputation: 32681

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

Upvotes: 950

manojlds
manojlds

Reputation: 301037

Do git help gitignore.

You will get the help page with following line:

A line starting with # serves as a comment.

Upvotes: 290

Related Questions