The .gitignore File
List patterns of files Git should not track, such as build output and secrets.
Example
printf '*.log\nnode_modules/\n.env\n' > .gitignore
touch app.log .env keep.txt
mkdir node_modules && touch node_modules/x
git status -sResult
?? .gitignore ?? keep.txt
Exercise
Ignore logs.
echo "" > .gitignore
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.