.gitignore Generator
Select your tech stack and generate a complete, production-ready .gitignore file. Combine multiple stacks and download the file instantly.
What is a .gitignore file?
A .gitignore file tells Git which files and directories to ignore when tracking changes. This typically includes build output, dependency folders (node_modules, vendor), log files, environment files containing secrets, and editor-specific files. Keeping these out of version control keeps repositories clean and prevents accidentally committing sensitive data.
Best practices
Always commit a .gitignore at the root of your project. Combine stack-specific rules (e.g. Node.js) with OS rules (macOS, Windows) and IDE rules (VS Code, JetBrains) for a comprehensive ignore file. Never add sensitive files like .env to version control.
What if I already committed a file I want to ignore?
Adding a file to .gitignore after it has been committed does not remove it from history. You need to run git rm --cached filename to untrack the file, then commit the change. The file will remain locally but will no longer be tracked.
Should I commit node_modules?
No. The node_modules directory can contain hundreds of thousands of files and should always be in .gitignore. Anyone cloning your repo can restore it by running npm install with your package.json and package-lock.json.