How to create a .gitignore file
- Select the languages, frameworks, editors, and operating systems your project uses. Use the search box to find them quickly.
- Add your own rules in the box on the left, such as .env or a build folder.
- Copy the result or download it as .gitignore, and put it in the root of your repository.
Templates are merged without repeated rules, so combining Node.js, Visual Studio Code, macOS, and Windows gives one tidy file. Turn off "Keep explanatory comments" for a shorter file.
Questions
Is anything uploaded?
No. The templates are bundled with the page and combined in your browser. The names of the templates you pick and the lines you add never leave your device.
Where do the templates come from?
They come from the community-maintained github/gitignore repository, which is public domain (CC0). This page includes about 80 of the most used ones for languages, frameworks, editors, and operating systems.
What happens when two templates have the same rule?
The rule is written once, in the first section that contains it, and the counter shows how many duplicates were removed. Comments that belong to a removed rule are dropped with it.
My file is already tracked. Why does .gitignore not hide it?
A .gitignore only affects files Git is not tracking yet. To stop tracking a file but keep it on disk, run git rm --cached <file> and commit. After that the ignore rule takes over.
Where do I put the file?
Save it as .gitignore in the root folder of your repository, next to the .git folder, then commit it. Editor and operating system rules are often better kept in your global ignore file, but a shared project file works fine too.
Credits
Built on github/gitignore (CC0-1.0). OneTooling is not affiliated with that project.