Initialize .gitignore with intelligent exclusion patterns based on your project's technology stack.
Create a comprehensive .gitignore file with intelligent patterns based on your project's detected technologies. Use it when starting a new project or adding Git to an existing one to prevent committing build artifacts, dependencies, and sensitive files.
/plugin marketplace add charlesjones-dev/claude-code-plugins-dev/plugin install ai-git@claude-code-plugins-devInitialize Git ignore patterns by creating or updating .gitignore with intelligent exclusion patterns based on your project's technology stack.
CRITICAL: This command MUST NOT accept any arguments. If the user provided any text, URLs, or paths after this command (e.g., /git-init ./project or /git-init --force), you MUST COMPLETELY IGNORE them. Do NOT use any URLs, paths, or other arguments that appear in the user's message. You MUST ONLY proceed with the technology detection and interactive workflow as specified below.
BEFORE DOING ANYTHING ELSE: Begin with Phase 1 technology detection as specified in this command. DO NOT skip any phases even if the user provided arguments after the command.
Set up comprehensive .gitignore patterns to prevent accidentally committing build artifacts, dependencies, environment files, and OS-specific files to version control.
Scan the project root directory to detect technologies and frameworks using the Glob tool (NOT bash commands):
Node.js Detection:
package.json, yarn.lock, pnpm-lock.yaml, bun.lockbPython Detection:
requirements.txt, pyproject.toml, setup.py, Pipfile, poetry.lock, setup.cfg.NET Detection:
*.csproj, *.sln, *.fsproj, *.vbproj, global.json, Directory.Build.propsGo Detection:
go.mod, go.sumRust Detection:
Cargo.toml, Cargo.lockPHP Detection:
composer.json, composer.lockRuby Detection:
Gemfile, Gemfile.lockJava Detection:
pom.xml, build.gradle, build.gradle.kts, settings.gradleDocker Detection:
Dockerfile, docker-compose.yml, docker-compose.yaml, .dockerignoreNext.js/React Detection:
next.config.js, next.config.ts, next.config.mjsVue Detection:
vue.config.js, nuxt.config.js, nuxt.config.tsTerraform Detection:
*.tf, terraform.tfvarsIMPORTANT:
Create a comprehensive .gitignore combining:
Environment & Secrets:
# Environment variables
.env
.env.*
.env.local
.env.development
.env.production
.env.test
!.env.example
# Secrets
credentials.json
secrets.yml
*.secret
*.pem
*.key
*.p12
*.jks
*.pfx
*.keystore
Operating System Files:
# macOS
.DS_Store
.AppleDouble
.LSOverride
._*
# Windows
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
Desktop.ini
$RECYCLE.BIN/
# Linux
*~
.directory
.Trash-*
IDE & Editor Files:
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# JetBrains IDEs
.idea/
*.iml
*.iws
*.ipr
.idea_modules/
# Vim
*.swp
*.swo
*~
# Emacs
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
# Sublime Text
*.sublime-workspace
*.sublime-project
Node.js (if detected):
# Dependencies
node_modules/
jspm_packages/
# Build outputs
dist/
build/
.next/
.nuxt/
out/
# Testing
coverage/
.nyc_output/
# Caching
.cache/
.turbo/
.parcel-cache/
.webpack/
# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
pnpm-debug.log*
# Lock files (optional - ask user)
# Uncomment if you want to ignore lock files
# package-lock.json
# yarn.lock
# pnpm-lock.yaml
Python (if detected):
# Byte-compiled / optimized
__pycache__/
*.py[cod]
*$py.class
*.so
# Virtual environments
.venv/
venv/
ENV/
env/
.python-version
# Distribution / packaging
dist/
build/
*.egg-info/
*.egg
.eggs/
wheels/
# Testing
.pytest_cache/
.tox/
.coverage
htmlcov/
.hypothesis/
# Type checking
.mypy_cache/
.dmypy.json
dmypy.json
.pytype/
# Linting
.ruff_cache/
# Jupyter Notebook
.ipynb_checkpoints
*.ipynb
.NET (if detected):
# Build results
bin/
obj/
out/
# User-specific files
*.user
*.suo
*.userosscache
*.sln.docstates
*.userprefs
# Visual Studio
.vs/
*.DotSettings.user
# Test results
TestResults/
[Tt]est[Rr]esult*/
*.trx
# NuGet
packages/
*.nupkg
*.snupkg
project.lock.json
project.fragment.lock.json
Go (if detected):
# Binaries
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary
*.test
# Output of the go coverage tool
*.out
# Dependency directories
vendor/
# Go workspace file
go.work
Rust (if detected):
# Compilation outputs
target/
Cargo.lock
# Backup files
**/*.rs.bk
*.pdb
PHP (if detected):
# Composer
vendor/
composer.lock
composer.phar
# Laravel
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
# Symfony
/var/
/vendor/
Ruby (if detected):
# Bundler
vendor/bundle/
.bundle/
# RVM
.rvmrc
# rbenv
.ruby-version
# RSpec
.rspec_status
# Coverage
coverage/
Java (if detected):
# Compiled class files
*.class
# Log files
*.log
# Package Files
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
# Gradle
.gradle/
build/
gradle-app.setting
!gradle-wrapper.jar
Docker (if detected):
# Docker override files
docker-compose.override.yml
docker-compose.override.yaml
Terraform (if detected):
# Terraform
.terraform/
*.tfstate
*.tfstate.*
*.tfvars
crash.log
override.tf
override.tf.json
*_override.tf
*_override.tf.json
Check if .gitignore already exists using the Read tool (NOT bash test commands):
.gitignore using the Read toolIMPORTANT:
Display a comprehensive preview showing:
Technologies Detected:
Current .gitignore (if exists):
Proposed .gitignore:
After Merge:
Ask for user confirmation before proceeding.
After user confirms:
Build the complete .gitignore content with proper formatting:
Write .gitignore using the Write tool (NOT bash echo or heredoc)
Show success message with:
.gitignoreIMPORTANT:
DO NOT:
test -f, [ -f ], etc.)DO:
.gitignore exists (handles errors gracefully)š Detecting technologies in your project...
Technologies Detected:
ā Node.js (package.json found)
ā TypeScript (tsconfig.json found)
ā Python (requirements.txt, pyproject.toml found)
ā Docker (Dockerfile, docker-compose.yml found)
Current .gitignore:
š .gitignore exists (42 lines)
š Sample patterns:
node_modules/
.env
dist/
...
Proposed .gitignore Structure:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Base Patterns:
⢠Environment & Secrets (12 patterns)
⢠Operating System Files (15 patterns)
⢠IDE & Editor Files (18 patterns)
Node.js Patterns:
⢠Dependencies (2 patterns)
⢠Build outputs (5 patterns)
⢠Testing & Caching (6 patterns)
⢠Logs (5 patterns)
Python Patterns:
⢠Byte-compiled (5 patterns)
⢠Virtual environments (5 patterns)
⢠Distribution (7 patterns)
⢠Testing (5 patterns)
Docker Patterns:
⢠Docker overrides (2 patterns)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Total patterns: 87
Estimated file size: ~150 lines (with comments)
Merge Strategy: Smart Merge (deduplicate, preserve comments, organize)
Would you like to proceed with this configuration? (yes/no)
ā .gitignore successfully initialized!
Configuration Summary:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
š File: .gitignore
š Total patterns: 87 (organized in 7 categories)
š”ļø Technologies covered: Node.js, TypeScript, Python, Docker
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Next Steps:
1. Review the generated .gitignore file
2. Run `git status` to see which files are now ignored
3. Remove any currently tracked files that should be ignored:
git rm --cached <file>
4. Commit the .gitignore file:
git add .gitignore
git commit -m "Add comprehensive .gitignore for detected technologies"
š” Tip: You can run this command again to update .gitignore when adding new technologies to your project.
Lock File Handling: When Node.js is detected, ask the user if they want to commit lock files (package-lock.json, yarn.lock, pnpm-lock.yaml):
Custom Patterns: During Smart Merge, detect and preserve:
Pattern Validation:
*, *.txt)