- 2 Minutes to read
- Print
- DarkLight
- PDF
What Is .gitignore and why your hardware projects need It
- 2 Minutes to read
- Print
- DarkLight
- PDF
Mastering .gitignore
: Keep Your Git Repo Clean and Focused
In hardware development, as in software, your Git repository is your source of truth. But not everything in your working directory belongs in version control. That’s where .gitignore
comes in.
This guide explains what .gitignore
is, how it works, and how to use it effectively to manage your ECAD and documentation workflows in Git.
What is .gitignore
?
.gitignore
is a special file that tells Git which files or directories to exclude from tracking. While Git tracks changes to your version-controlled files, it ignores anything matched by rules in this file.
This is particularly useful for:
- Temporary files (e.g. auto-generated files from ECAD tools)
- Build artifacts
- IDE and OS metadata
- Local documentation or export folders
How Git Uses .gitignore
Git applies .gitignore
rules recursively from the directory the file lives in. Typically, you’ll place a .gitignore
file in your repository root, though you can also add directory-specific .gitignore
files when needed.
Ignored files:
- Won’t appear in
git status
- Won’t be added to commits
- Can still exist in your working directory for local use
Note: If a file has already been committed,
.gitignore
won’t remove it. You’ll need to delete it and recommit if you want it gone from version control.
How to Create a .gitignore
File
- Create a file named
.gitignore
in the root of your repository. - Add rules line by line.
Example:
# Ignore generated simulation files
*.out
*.log
# Ignore KiCad backup and autosave files
*.bak
*.tmp
# Ignore system files
.DS_Store
Thumbs.db
Each rule matches a file pattern or path. Patterns can include:
*
(wildcard)/
(for specific path)!
(to negate a rule)
Example: Ignoring a Dedicated Folder Like _ignore/
A common pattern in hardware projects is to create a local dump folder for experiments, images, exports, or test scripts. You can name it _ignore/
to clearly signal its purpose.
To ignore the entire folder:
# Ignore all files in the _ignore directory
_ignore/
This tells Git to skip all content inside _ignore/
, but still lets your team use it locally for sandbox files or temporary assets.
ECAD-Friendly .gitignore
Examples
KiCad
*.bak
*.kicad_sch-bak
*.tmp
*.~* # temporary files
*.dcm
*.net
*.xml
*.cache/
Altium
__Previews/
History/
*.OutJob
*.PcbDocPreview
*.PrjPCBStructure
General Hardware Projects
# Output folders
build/
output/
*.zip
# Sim files
*.vcd
*.out
*.log
AllSpice-Hosted .gitignore
Templates
We maintain curated .gitignore
templates for common ECAD tools. You can use these as a starting point in your hardware projects:
You can include them directly in your repositories or adapt them to your tool-specific workflows.
Tips and Best Practices
Use comments: Document why certain patterns are ignored.
Keep it repo-specific: Don’t copy-paste
.gitignore
files blindly; tailor them to your toolchain and workflow.Add exceptions with
!
: Useful for keeping a README inside an ignored directory:_ignore/* !_ignore/README.md
Use a global
.gitignore
for system-wide ignores: e.g. editor configs or OS files (~/.gitignore_global
).
Wrapping Up
A thoughtful .gitignore
file keeps your repository clean, focused, and easier for collaborators to work with. Whether you're managing a complex ECAD workflow or a simple schematic, understanding how to exclude noise from your version history is a key Git skill.
Want to dig deeper into Git workflows for hardware? Check out our articles on branching strategies, design review automation, and more on learn.allspice.io.