How to use the .gitignore Generator
- 1. Tick your stackChoose languages and frameworks, your editor and the operating systems your team uses.
- 2. Add your own linesType extra folders such as uploads/ or secrets/, one per line.
- 3. Download .gitignoreSave the file in the root of your repository and commit it.
What you get with the defaults
Node.js, VS Code, macOS and Windows are ticked when the page opens. The file starts with a Node.js block containing node_modules/, the npm, Yarn and pnpm debug logs, .env with !.env.example so a sample file can still be shared, and the dist, build and coverage folders. Then come .vscode/* with exceptions for shared settings, .DS_Store for macOS, and Thumbs.db and Desktop.ini for Windows.
If two templates contain the same line, such as dist/ in Node.js and Python, it appears only once, so the file stays short and readable. Each block has a ### heading so teammates can see why a rule exists.
How .gitignore rules work
- A line like
logs/ignores a folder anywhere in the repository. *.logignores every file ending in .log.- A leading slash, as in
/build, matches only at the top level. - A line starting with
!brings back a file that an earlier rule ignored.
.gitignore only affects files Git is not already tracking. If you committed a file by mistake, run git rm --cached file, commit, and then the rule takes effect. If that file held a password or API key, treat the key as leaked and rotate it, because it is still in the history. The Git commands cheat sheet lists the related commands, and the .env to JSON converter helps when you move settings between formats.
Frequently asked questions
Where do I put the .gitignore file?
In the root folder of the repository, next to the .git folder. You can also add more .gitignore files inside subfolders for rules that only apply there.
Should I ignore package-lock.json?
No. Lock files make installs repeatable, so commit package-lock.json, poetry.lock, go.sum and similar files.
Is the .gitignore Generator free?
Yes, the .gitignore Generator is free. The first time you generate your first .gitignore, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.