Ignoring Files with .ditsignore
Control which files Dits tracks by specifying patterns in a .ditsignore file. Keep your repository clean by excluding build artifacts, temporary files, and sensitive data.
Similar to .gitignore
If you're familiar with Git, .ditsignore uses the same pattern syntax as .gitignore. You can often use your existing .gitignore as a starting point.
Creating a .ditsignore File
Create a file named .ditsignore in your repository root:
# Create .ditsignore
touch .ditsignore
# Or copy from your existing .gitignore
cp .gitignore .ditsignorePattern Syntax
Basic Patterns
# Ignore specific file
secret.key
# Ignore by extension
*.log
*.tmp
*.cache
# Ignore directory
node_modules/
build/
dist/
# Ignore files in any directory
**/debug.logNegation Patterns
# Ignore all .log files
*.log
# But track important.log
!important.log
# Ignore build/ but keep build/readme
build/
!build/readme.mdPattern Reference
| Pattern | Description | Example Matches |
|---|---|---|
| *.ext | All files with extension | file.ext, dir/file.ext |
| dir/ | Directory and contents | dir/*, dir/sub/* |
| **/file | File in any directory | file, a/file, a/b/file |
| dir/**/file | File in dir or subdirs | dir/file, dir/a/b/file |
| !pattern | Negate (don't ignore) | Track despite earlier rule |
| [abc] | Character class | a, b, or c |
| ? | Single character wildcard | file?.txt matches file1.txt |
Common Templates
Node.js / JavaScript
# Dependencies
node_modules/
package-lock.json
# Build output
dist/
build/
.next/
# Environment
.env
.env.local
.env.*.local
# IDE
.vscode/
.idea/
# OS files
.DS_Store
Thumbs.dbVideo Production
# Render outputs (re-generate from project)
renders/
exports/
*.mp4
*.mov
# Cache files
*.peak
*.pkf
Media Cache/
# Proxies (managed by Dits proxy system)
proxies/
# Keep project files
!*.prproj
!*.aep
!*.drpGame Development
# Build outputs
Build/
Builds/
*.exe
*.app
# Cache
Library/
Temp/
obj/
# IDE
.vs/
*.csproj.user
# Keep assets
!Assets/**/*.fbx
!Assets/**/*.pngChecking Ignored Files
# Check if a file is ignored
$ dits check-ignore myfile.log
myfile.log
# See which rule ignores a file
$ dits check-ignore -v myfile.log
.ditsignore:5:*.log myfile.log
# List all ignored files
$ dits status --ignoredGlobal Ignore File
Create a global ignore file for patterns that apply to all your repositories:
# Set global ignore file
dits config --global core.excludesfile ~/.ditsignore_global
# Add common patterns
echo ".DS_Store" >> ~/.ditsignore_global
echo "Thumbs.db" >> ~/.ditsignore_global
echo "*.swp" >> ~/.ditsignore_globalAlready Tracked Files
Adding a file to .ditsignore won't remove it if it's already tracked. Use
dits rm --cached filename to untrack it first.Related Topics
- File Commands - Managing tracked files
- Configuration - Global settings
- Large Files Guide - Handling big assets