# Ignore node_modules in any JavaScript project node_modules/
# Ignore the build output directory /dist
# Ignore log files *.log
# Ignore all .env files .env*
# Include .env.example file !.env.example
# Ignore compiled Python files *.pyc
# Ignore the database file in a Django project *.sqlite3
Remember, the patterns in a .gitignore file are relative to the location of the .gitignore file itself. Typically, you'd place this file in the root directory of your repository so it applies to the entire repo. After editing the .gitignore file, you need to commit it to your repository for the changes to take effect.
/dir/
Pattern: /logdir/
Meaning: This pattern ignores only the logdir directory located at the root of the repository.
Example
:
It will match and ignore logdir/ in the root of the repository.
It will not match and ignore subdir/logdir/, anotherdir/logdir/, etc.
dir/
Pattern: logdir/
Meaning: This pattern ignores any directory named logdir and its contents, regardless of its location in the repository.
Example:
It will match and ignore logdir/ in the root of the repository.
It will also match and ignore subdir/logdir/, anotherdir/logdir/, and so on.