Skip to content
Justice Tech School

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 -s

Result

?? .gitignore
?? keep.txt

Exercise

Ignore logs.

echo "" > .gitignore

Quiz Test

What does .gitignore stop?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.