.gitignore Generator
Generate a .gitignore file by selecting the languages, editors, and operating systems your project uses. Templates are based on the community maintained patterns from GitHub’s gitignore collection. Select multiple templates to combine them. The output is deduplicated and grouped by category.
How to Use
- Search or browse the template list on the left. Templates are grouped by category: languages, editors, operating systems, and frameworks.
- Check the boxes for each technology in your project. Most projects need at least one language, one editor, and one OS template.
- Add any rules specific to your project in the custom rules box. One pattern per line, same syntax as a standard .gitignore.
- Copy the output with the Copy button or download it directly as a .gitignore file.
- Place the file in your repository root and commit it.
How .gitignore Patterns Work
Each line in a .gitignore file is a glob pattern that tells Git which files and directories to exclude from version control. A trailing slash (dir/) means only match directories. A leading slash (/file) anchors the pattern to the repository root. An asterisk (*) matches anything except a slash, and a double asterisk (**) matches across directories.
Git processes .gitignore rules top to bottom. Later rules override earlier ones, which is how negation patterns (!keep-this-file) work. Blank lines are ignored, and lines starting with # are comments.
The most common mistake is adding patterns after the file is already tracked. Git only applies .gitignore to untracked files. If you committed node_modules/ before adding it to .gitignore, run git rm -r --cached node_modules/ to untrack it, then commit. The directory stays on disk but stops appearing in git status.
For files that should never be tracked across any repository on your machine (like .DS_Store or Vim swap files), configure a global gitignore with git config --global core.excludesFile ~/.gitignore_global. This keeps your project .gitignore focused on rules specific to the project.
Comparing different versions of your .gitignore? The Diff Checker shows changes side by side. Need to clean up the formatting of config files in your project? Try the Code Formatter.