Perl .gitignore template
The Perl template ignores the staging library tree, the generated build scripts and metadata files, and coverage output from the standard test tooling.
At a glance
- Category
- Language
- Patterns in this template
- 18 rules
- Directories ignored
- 5 of the 18 rules end in a slash, so they match directories only
- Also needs an OS template
- Yes. Nothing here matches editor or file manager artefacts.
- Typical companions
- An editor template and an OS template.
In detail
/blib is the build library, the staging tree where the build tooling copies modules and scripts into their installed layout before running tests against them. It is a rearranged copy of files that are already in the repository, so it adds nothing except duplication and a stale copy waiting to confuse someone.
The generated build scripts are the awkward part of this template. MakeMaker generates a Makefile from Makefile.PL, and Module::Build generates a Build script from Build.PL. This template ignores Makefile, Build and Build.bat, which is correct for the generated files. But if your project keeps a hand written Makefile for convenience, that file is matched too, with no warning at all.
META.yml, META.json and MYMETA.* are distribution metadata. The MYMETA files are always generated at configure time and should never be tracked. META.yml and META.json are trickier: for a distribution built by the standard tooling they are generated during packaging, but some projects deliberately track a hand maintained copy, and this template assumes they do not.
cover_db is the coverage database from the standard coverage tool, holding a per run record of which statements executed. inc is the vendored dependency directory some older distributions use to bundle the modules needed at build time. *.o and *.bs come from XS, the interface that lets a Perl module link against C.
MANIFEST.bak and pm_to_blib are small housekeeping artefacts: a backup of the manifest and a timestamp file recording that the copy into blib has already happened. *.pm.tdy is the output of running the standard formatter, which writes a tidied copy alongside the original rather than in place.
Examples
/blib/
/.build/
_build/
cover_db/
inc/
Build
Build.bat
META.yml
META.json
MYMETA.*
*.o
*.pm.tdy
*.bs
Makefile
Makefile.old
MANIFEST.bak
pm_to_blib
*.tar.gz18 lines exactly as the tool writes them, before any common additions you tick.
Things that catch people out
- The Makefile rule ignores a hand written Makefile at the root as readily as a generated one. Negate the specific path if your Makefile is source.
- META.yml and META.json are ignored here. If your distribution tracks a maintained copy on purpose, remove those two lines or the packaging step will quietly stop shipping what you intended.
- *.tar.gz is unanchored, so a test fixture archive anywhere in the repository is ignored along with the release tarball this rule was written for.
Try it: .gitignore Generator
Pick one or more templates, tick the common additions you want, and copy or download the combined .gitignore.
.gitignore Generator
LOCAL · Browser-OnlyGenerate comprehensive .gitignore files by combining templates for languages, frameworks, IDEs, and operating systems
Language
Framework
IDE
OS
Build Tool
Infrastructure
Common Additions
Preview
Select templates or common additions to generate a .gitignore file.
Related .gitignore templates
All .gitignore templates →C .gitignore template
What the C .gitignore template covers: object files, static and shared libraries, linker maps, debug symbols and the patterns that swallow a vendored binary.
Ruby .gitignore template
The Ruby template anchors most rules to the repository root with a leading slash, and ignores Gemfile.lock, which is right for a gem and wrong for an app.
Python .gitignore template
A line by line read of the Python .gitignore template: bytecode caches, virtual environments, packaging output, test caches and the lib/ rule that bites.
Haskell .gitignore template
What the Haskell template covers: object and interface files, the dist output directories, profiling and event log output, and the local project overrides.
Elixir .gitignore template
The Elixir template anchors its rules to the project root and ignores compiled beam files, fetched dependencies, crash dumps and the secret config convention.
Jupyter Notebook .gitignore template
The Jupyter template ignores autosave checkpoints and profile folders, but the real problem with notebooks in git is the output cells, which no rule fixes.
Tools for this
- .gitignore Generator Generate .gitignore files for any project - 50+ templates for languages, frameworks, IDEs, and OS