.gitignore Generator
Make a clean .gitignore for your project in seconds: tick your stack, editor and operating system, add your own rules, and test whether a given path will be ignored.
Działa w Twojej przeglądarce. Twoje pliki nigdy nie opuszczają urządzenia. Zobacz, jak to sprawdzić
…
Jak to zrobić
- 1Tick your stack
Choose languages, frameworks, editors and operating systems.
- 2Add your rules
Type project-specific patterns.
- 3Test paths
Enter paths to see if they are ignored and why.
- 4Copy or download
Save the file as .gitignore in the repository root.
- 5Untrack old files
Run git rm --cached on files already committed.
- 6Commit
Add and commit the .gitignore.
O tym narzędziu
Every Git repository needs a .gitignore file so that dependencies, build output, logs, editor settings and secrets never end up in a commit. Writing one by hand means remembering that Python creates __pycache__, that Gradle keeps a .gradle folder, that macOS sprinkles .DS_Store everywhere and that Next.js builds into .next. This generator holds ready templates for 45 languages, frameworks, build tools, game engines, editors and operating systems, based on the community github/gitignore collection. Tick what your project uses and the rules are merged into one file with section comments, with duplicate lines removed. Add rules of your own for project-specific folders. Then type a few paths into the tester to check what would be ignored and which rule decides it, using the same matching rules as Git: folder-only patterns, leading slashes, double-star wildcards and negation with an exclamation mark.
How .gitignore patterns work
- A pattern without a slash, such as *.log, matches files of that name in any folder. - A leading slash anchors the pattern to the repository root: /build ignores the top-level build folder only. - A trailing slash matches folders only: node_modules/ does not match a file called node_modules. - Two stars match any number of folders: docs/**/*.tmp matches docs/a/b/c.tmp. - An exclamation mark re-includes something an earlier rule excluded: !.env.example keeps the example file while .env.* ignores the rest. - The last matching rule wins, which is why order matters for negations.
The path tester
Type one path per line, ending folders with a slash. Each line shows whether it would be ignored or tracked and which rule decided. This catches the classic mistakes: a negation placed before the rule it should override, or a pattern anchored when it should not be.
Secrets
Tick "Secrets and keys" to ignore private keys, certificates and .env files while keeping .env.example. A .gitignore only stops new files from being added; if a secret was ever committed, it is still in the history and must be rotated.
Files already tracked
Adding a rule does not untrack files Git already knows about. Run git rm --cached on them once, commit, and from then on the rule applies.
Global ignores
Editor and operating system files are better kept in a global ignore file so every repository benefits: save those sections as ~/.gitignore_global and run git config --global core.excludesFile ~/.gitignore_global.
Limits
Templates cover the common case; unusual project layouts may need extra rules. Pattern matching follows the Git documentation, but always confirm with git status or git check-ignore -v before relying on it for sensitive files.
Przykład z rozwiązaniem
A Next.js project on a Mac: ticking Node, Next.js, VS Code, macOS and Secrets and keys gives a 52-line file; the tester shows node_modules/react/index.js and .env ignored by node_modules/ and .env, while .env.example stays tracked thanks to !.env.example.
W skrócie
- Kategoria: Programowanie i dane
- Działa w przeglądarce, bez rejestracji i wysyłania.
- Wpisane informacje zostają na Twoim urządzeniu.
- Dostępne po angielsku.
- Treść ostatnio sprawdzona:
- Oficjalne źródło: Git documentation: gitignore pattern format
Najczęstsze pytania
Which templates are included?
Forty-five: languages, frameworks, build tools, mobile, game engines, DevOps, editors and operating systems.
Will it remove duplicate rules?
Yes. Lines that appear in several templates are kept once.
Why is a file still tracked after adding a rule?
Git keeps tracking files it already knows; run git rm --cached on them once.
Can I test my own rules?
Yes. Paths are tested against the generated file, including your custom rules.
Does it follow Git's matching rules?
Yes: anchoring, folder-only patterns, double stars, character ranges and negation.
Is anything uploaded?
No. The file is built in your browser.
