gitignore file Patterns and Format (.gitignore)
- Blank Line: A blank line doesn’t refer to any file name, so we can use it to separate two file names for the ease of reading .
- #: A line beginning with the # symbol refers to a comment .However if # is used as a pattern then use backslash (“\”) before the # symbol so that it is not misunderstood as a comment.
- /: It is used as a directory separator i.e to include directories, for example webdev/ .
- *.extension_name: For example *.txt and *.log can be used to match ALL the files that have .txt and .log as their extension respectively.
- **/any_name: It is used to match any file or directory with the name any_name.
- any_name/**: It is used to match anything that is inside the directory of the name any_name. for example webdev/** matches all the files inside webdev directory.
What is Git-Ignore and How to Use it?
There are various types of files we might want the git to ignore before committing, for example, the files that are to do with our user settings or any utility setting, private files like passwords and API keys. These files are not of any use to anyone else and we do not want to clutter our git. We can do this with the help of “