.gitignore in Git

The .gitignore is a special file in git to ignore files in git to track, we can specify those file names in the .gitignore file.

Create a file named .gitignore if we do not have it already in our directory. To create a file, use the touch command. It will use as follows:

Bash

touch .gitignore

The above command will create a .gitignore file on our directory.

There are following rules for writing the names of file or folders in .gitignore:
1. All the files with the extension .log are ignored.
*.log

2. The following syntax will ignore the directory (or folder) Dir and everything inside it.
Dir/