Ignoring files and directories

Git has a feature that allows you to ignore files and directories by placing a file named .gitignore in the root of your repository. This file contains a list of patterns that Git will use to determine which files and directories to ignore.












Example .gitignore file

# We are working on a Mac
.DS_Store

# Ignore all .txt files
*.txt

# Ignore all files in the temp directory
temp/

# Ignore node_modules directory
node_modules/