.gitignore sample file

create .gitignore in the root of your project and add the following content. Note: a "#" is only treated as a comment when it's the first character of the line — a trailing "# comment" after a pattern is NOT stripped and becomes part of the literal pattern, so it will silently stop matching anything. Put comments on their own line.

# Ignore compiled executables and object files
*.exe
*.o
*.obj

# Ignore temporary files and editor backups
*~
*.bak
*.tmp
# macOS specific
.DS_Store
# Windows specific
Thumbs.db

# Ignore specific directories
build/
dist/
node_modules/
vendor/

# Ignore log files
*.log

# Ignore sensitive configuration files
config.local.js
.env

# Ignore specific file types anywhere in the project
*.zip
*.tar.gz

# Exception: don't ignore important.log even if other .log files are ignored
!important.log

# Ignore everything in the 'data' directory except for 'data/important_data.csv'
/data/*
!/data/important_data.csv

related topics

Git Cheat Sheet — the git basics this file quietly protects.
Git LFS — for the large files .gitignore alone can't handle well.
.gitconfig Reference — another dotfile worth customizing early.