Loading

Quipoin Menu

Learn • Practice • Grow

git / Ignoring Files
tutorial

Ignoring Files

Not all files should be tracked by Git. Compiled files, temporary files, environment-specific configurations, and sensitive data should be ignored. Git uses a special file called .gitignore for this purpose.

What Is .gitignore?

A .gitignore file contains a list of patterns that Git should ignore. Once a file is ignored, Git will not track it, and it won’t appear in git status as untracked.

Creating .gitignore

Create the file in the root of your repository:
touch .gitignore
Then open it in a text editor and add patterns.

Common Patterns

  • *.log – ignore all .log files
  • build/ – ignore the entire build folder
  • secret.env – ignore a specific file
  • *.swp – ignore vim swap files
  • node_modules/ – ignore dependencies
  • .DS_Store – ignore macOS system file

Example .gitignore

# Compiled output
dist/
build/
*.class

# Dependencies
node_modules/

# Environment
.env
.env.local

# OS files
.DS_Store
Thumbs.db

Checking What’s Ignored

To see which files are ignored, use:
git status --ignored

Global .gitignore

You can set a global ignore file for all repositories on your machine:
git config --global core.excludesfile ~/.gitignore_global
This is useful for OS‑specific files like .DS_Store.


Two Minute Drill
  • .gitignore tells Git which files to ignore.
  • Patterns can match filenames, folders, or extensions using wildcards (*).
  • Add .gitignore to your repository so others share the same ignore rules.
  • Use git status --ignored to see ignored files.
  • Create a global ignore file for OS‑specific files.

Need more clarification?

Drop us an email at career@quipoinfotech.com