Commit badc3013ada3
Changed files (9)
dots/.config/claude/skills/Git/workflows/Bisect.md
@@ -0,0 +1,465 @@
+# Bisect Workflow
+
+Find the commit that introduced a bug using binary search.
+
+## When to Use
+
+- "find bad commit"
+- "git bisect"
+- "when did this break"
+- "regression debugging"
+
+## Quick Commands
+
+### Basic Bisect
+```bash
+# Start bisect
+git bisect start
+
+# Mark current commit as bad
+git bisect bad
+
+# Mark known good commit
+git bisect good v1.0.0
+
+# Or use commit hash
+git bisect good abc1234
+
+# Git will checkout middle commit
+# Test and mark:
+git bisect bad # if broken
+git bisect good # if working
+
+# Repeat until found
+# Git will show: "abc1234 is the first bad commit"
+
+# End bisect session
+git bisect reset
+```
+
+### Automated Bisect
+```bash
+# Start bisect
+git bisect start HEAD v1.0.0
+
+# Run automated test
+git bisect run ./test.sh
+
+# Git will automatically find bad commit
+# Bisect session ends automatically
+```
+
+## How Bisect Works
+
+### Binary Search Process
+```
+Commits: A---B---C---D---E---F---G
+ good bad
+
+# Round 1: Test D (middle)
+A---B---C---D---E---F---G
+ good ? bad
+# D is bad
+
+# Round 2: Test B
+A---B---C---D
+ ? bad
+# B is good
+
+# Round 3: Test C
+B---C---D
+good ? bad
+# Found! C is first bad commit
+```
+
+### Efficiency
+```bash
+# For 100 commits: ~7 tests (log2(100))
+# For 1000 commits: ~10 tests (log2(1000))
+# Much faster than linear search!
+```
+
+## Manual Bisect Process
+
+### Step-by-Step Example
+```bash
+# 1. Start bisect
+git bisect start
+
+# 2. Mark current state as bad
+git bisect bad
+
+# 3. Find known good commit
+git log --oneline
+git bisect good v2.0.0 # or commit hash
+
+# 4. Test current state
+npm test # or whatever test
+# If it fails:
+git bisect bad
+# If it passes:
+git bisect good
+
+# 5. Repeat step 4 until done
+
+# 6. Git will show:
+# abc1234 is the first bad commit
+# commit abc1234
+# Author: ...
+# Date: ...
+# feat: add user authentication
+
+# 7. View the bad commit
+git show abc1234
+
+# 8. End bisect
+git bisect reset
+```
+
+## Automated Bisect
+
+### Using Test Script
+```bash
+# Create test script: test.sh
+#!/bin/bash
+npm test
+exit $? # Return test exit code
+
+# Make executable
+chmod +x test.sh
+
+# Run automated bisect
+git bisect start HEAD v1.0.0
+git bisect run ./test.sh
+```
+
+### Test Script Requirements
+```bash
+# Script must:
+# - Exit 0 if commit is GOOD
+# - Exit 1-127 (except 125) if commit is BAD
+# - Exit 125 if commit cannot be tested (will skip)
+
+# Example test script
+#!/bin/bash
+
+# Build project
+make build || exit 125 # Skip if build fails
+
+# Run tests
+make test
+exit $?
+```
+
+### Complex Test Script
+```bash
+#!/bin/bash
+
+# Example: Testing for specific bug
+# Bug: API returns 500 on /users endpoint
+
+# Start server
+npm start &
+SERVER_PID=$!
+sleep 5 # Wait for startup
+
+# Test endpoint
+response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/users)
+
+# Cleanup
+kill $SERVER_PID
+
+# Check result
+if [ "$response" = "200" ]; then
+ exit 0 # Good commit
+else
+ exit 1 # Bad commit
+fi
+```
+
+## Bisect with Specific Path
+
+### Limit to Specific Files
+```bash
+# Only bisect commits that touched specific files
+git bisect start -- src/auth.ts src/user.ts
+
+# Or specific directory
+git bisect start -- src/api/
+```
+
+## Handling Build Failures
+
+### Skip Untestable Commits
+```bash
+# During manual bisect, if commit won't build:
+git bisect skip
+
+# Git will try a different commit nearby
+
+# Skip multiple commits
+git bisect skip v1.0..v1.5
+```
+
+### In Automated Script
+```bash
+#!/bin/bash
+
+# Try to build
+npm install && npm run build
+if [ $? -ne 0 ]; then
+ exit 125 # Cannot test this commit, skip it
+fi
+
+# Run tests
+npm test
+exit $?
+```
+
+## Bisect Subcommands
+
+### Viewing Bisect State
+```bash
+# See bisect log
+git bisect log
+
+# See current bisect state
+cat .git/BISECT_LOG
+
+# See remaining commits to test
+git bisect visualize
+git bisect view # Same as visualize
+```
+
+### Replaying Bisect
+```bash
+# Save bisect session
+git bisect log > bisect-session.txt
+
+# Replay later
+git bisect reset
+git bisect replay bisect-session.txt
+```
+
+## Common Use Cases
+
+### Finding Performance Regression
+```bash
+#!/bin/bash
+# performance-test.sh
+
+# Run benchmark
+result=$(go test -bench=. -count=5 | grep "BenchmarkMain" | awk '{print $3}')
+
+# Extract ns/op (assuming format like "1234 ns/op")
+nsop=$(echo $result | awk '{print $1}')
+
+# Good if under 1000 ns/op
+if [ "$nsop" -lt 1000 ]; then
+ exit 0
+else
+ exit 1
+fi
+```
+
+```bash
+# Run automated bisect
+git bisect start HEAD v2.0.0
+git bisect run ./performance-test.sh
+```
+
+### Finding Broken Feature
+```bash
+#!/bin/bash
+# feature-test.sh
+
+# Setup test environment
+docker-compose up -d
+sleep 10
+
+# Run specific test
+pytest tests/test_user_feature.py
+
+result=$?
+
+# Cleanup
+docker-compose down
+
+exit $result
+```
+
+### Finding Compilation Error
+```bash
+#!/bin/bash
+# build-test.sh
+
+# Attempt build
+make clean
+make 2>/dev/null
+
+if [ $? -eq 0 ]; then
+ exit 0 # Builds successfully
+else
+ exit 1 # Build fails
+fi
+```
+
+## Advanced Techniques
+
+### Bisect Terms (Good/Bad Aliases)
+```bash
+# Use custom terms instead of good/bad
+git bisect start --term-old=fast --term-new=slow
+
+# Now use:
+git bisect fast # instead of good
+git bisect slow # instead of bad
+```
+
+### Bisect with Complex Logic
+```bash
+#!/bin/bash
+# complex-test.sh
+
+# Multiple test conditions
+build_passes=false
+tests_pass=false
+
+# Check build
+if make build; then
+ build_passes=true
+fi
+
+# Check tests
+if npm test; then
+ tests_pass=true
+fi
+
+# Complex logic
+if $build_passes && $tests_pass; then
+ exit 0 # Good
+elif ! $build_passes; then
+ exit 125 # Skip - can't test
+else
+ exit 1 # Bad - builds but tests fail
+fi
+```
+
+## Bisect Best Practices
+
+1. **Know your good commit**: Find a commit where feature definitely worked
+2. **Make test specific**: Test only the broken behavior, not everything
+3. **Keep test fast**: Faster tests = faster bisect
+4. **Use skip for build failures**: Don't waste time on unbuildable commits
+5. **Automate when possible**: Manual testing is error-prone
+6. **Test before bisecting**: Verify your test works on good and bad commits
+7. **Document the bug**: Clear understanding helps write better tests
+
+## Troubleshooting
+
+### Bisect Not Finding Bug
+```bash
+# Verify test works
+git checkout <known-bad-commit>
+./test.sh # Should fail
+
+git checkout <known-good-commit>
+./test.sh # Should pass
+
+# If both pass or both fail, fix your test script
+```
+
+### Inconsistent Test Results
+```bash
+# Some tests are flaky (pass/fail randomly)
+# Solution: Run test multiple times
+
+#!/bin/bash
+# stable-test.sh
+
+for i in {1..5}; do
+ npm test || exit 1
+done
+exit 0
+```
+
+### Too Many Commits
+```bash
+# Narrow down range first
+git log --oneline v1.0..v2.0 # See all commits
+
+# Try to narrow by date
+git bisect start HEAD "$(git rev-list -1 --before='2024-01-01' HEAD)"
+
+# Or by specific commit
+git bisect start HEAD abc1234
+```
+
+## Real-World Examples
+
+### Finding Memory Leak
+```bash
+#!/bin/bash
+# memory-test.sh
+
+# Run app with memory profiling
+node --expose-gc --max-old-space-size=100 app.js &
+PID=$!
+
+# Monitor memory for 30 seconds
+sleep 30
+
+# Check memory usage
+mem=$(ps -o rss= -p $PID)
+kill $PID
+
+# Good if under 80MB
+if [ "$mem" -lt 80000 ]; then
+ exit 0
+else
+ exit 1
+fi
+```
+
+### Finding Test Flakiness
+```bash
+#!/bin/bash
+# flaky-test-finder.sh
+
+# Run test 100 times
+for i in {1..100}; do
+ npm test -- test/flaky.test.js || exit 1
+done
+exit 0
+```
+
+### Finding Breaking Change
+```bash
+#!/bin/bash
+# api-compatibility-test.sh
+
+# Run API compatibility tests
+npm run test:api
+
+if [ $? -eq 0 ]; then
+ exit 0 # API compatible
+else
+ exit 1 # Breaking change
+fi
+```
+
+## Bisect Configuration
+
+```bash
+# Show progress
+git config --global bisect.showProgress true
+
+# Default number of commits to show in visualize
+git config --global bisect.visualizeCommits 20
+```
+
+## Resources
+
+- [Git Bisect Documentation](https://git-scm.com/docs/git-bisect)
+- [Fighting Regressions with Git Bisect](https://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git#_binary_search)
+- [Automated Testing with Git Bisect](https://www.metaltoad.com/blog/automated-testing-git-bisect)
dots/.config/claude/skills/Git/workflows/Branch.md
@@ -0,0 +1,205 @@
+# Branch Workflow
+
+Manage Git branches effectively with naming conventions and cleanup strategies.
+
+## When to Use
+
+- "create git branch"
+- "switch branches"
+- "delete branch"
+- "list branches"
+
+## Quick Commands
+
+### Creating Branches
+```bash
+# Create and switch to new branch
+git checkout -b feature/user-auth
+
+# Create branch without switching
+git branch feature/user-auth
+
+# Create from specific commit
+git checkout -b bugfix/issue-123 abc1234
+
+# New syntax (Git 2.23+)
+git switch -c feature/user-auth
+```
+
+### Switching Branches
+```bash
+# Switch to existing branch
+git checkout main
+git switch main # Git 2.23+
+
+# Switch to previous branch
+git checkout -
+git switch -
+
+# Switch and create if doesn't exist
+git checkout -b feature/new-feature
+```
+
+### Listing Branches
+```bash
+# List local branches
+git branch
+
+# List all branches (local + remote)
+git branch -a
+
+# List with last commit
+git branch -v
+
+# List merged branches
+git branch --merged
+
+# List unmerged branches
+git branch --no-merged
+
+# List branches with pattern
+git branch --list 'feature/*'
+```
+
+## Branch Naming Conventions
+
+### Standard Format
+```
+<type>/<description>
+```
+
+### Types
+- `feature/` - New features
+- `fix/` or `bugfix/` - Bug fixes
+- `hotfix/` - Urgent production fixes
+- `chore/` - Maintenance tasks
+- `docs/` - Documentation
+- `refactor/` - Code refactoring
+- `test/` - Test additions/fixes
+
+### Examples
+```bash
+git checkout -b feature/user-authentication
+git checkout -b fix/null-pointer-login
+git checkout -b hotfix/security-patch
+git checkout -b chore/update-dependencies
+git checkout -b docs/api-documentation
+git checkout -b refactor/simplify-handlers
+```
+
+## Deleting Branches
+
+### Local Branches
+```bash
+# Delete merged branch (safe)
+git branch -d feature/completed
+
+# Force delete (even if unmerged)
+git branch -D feature/abandoned
+
+# Delete multiple branches
+git branch -d feature/old-1 feature/old-2
+```
+
+### Remote Branches
+```bash
+# Delete remote branch
+git push origin --delete feature/old-branch
+
+# Alternative syntax
+git push origin :feature/old-branch
+```
+
+### Bulk Cleanup
+```bash
+# Delete all merged local branches
+git branch --merged | grep -v "\*\|main\|master" | xargs -n 1 git branch -d
+
+# Delete all local branches except main/master
+git branch | grep -v "main\|master" | xargs git branch -D
+
+# Prune deleted remote branches
+git fetch --prune
+git remote prune origin
+```
+
+## Remote Branch Tracking
+
+### Setting Upstream
+```bash
+# Push and set upstream
+git push -u origin feature/new-feature
+
+# Set upstream for existing branch
+git branch --set-upstream-to=origin/feature/new-feature
+
+# Short form
+git branch -u origin/feature/new-feature
+```
+
+### Tracking Info
+```bash
+# Show tracking branches
+git branch -vv
+
+# Check remote tracking
+git remote show origin
+```
+
+## Renaming Branches
+
+### Local Branch
+```bash
+# Rename current branch
+git branch -m new-name
+
+# Rename other branch
+git branch -m old-name new-name
+```
+
+### Remote Branch
+```bash
+# Rename local, delete old remote, push new
+git branch -m old-name new-name
+git push origin --delete old-name
+git push -u origin new-name
+```
+
+## Branch Management Strategies
+
+### Keep Branches Updated
+```bash
+# Update main before creating branch
+git checkout main
+git pull
+git checkout -b feature/new-work
+
+# Regularly sync with main
+git fetch origin
+git rebase origin/main
+```
+
+### Clean Gone Branches
+```bash
+# List gone branches
+git branch -vv | grep ': gone]'
+
+# Delete all gone branches
+git fetch --prune
+git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D
+```
+
+## Best Practices
+
+1. **Use descriptive names**: `feature/add-user-auth` not `feature/fix`
+2. **Keep branches short-lived**: Merge or delete within days/weeks
+3. **One concern per branch**: Don't mix features and fixes
+4. **Update regularly**: Rebase on main frequently
+5. **Delete after merge**: Clean up merged branches
+6. **Use consistent naming**: Follow team conventions
+7. **Protect main/master**: Use branch protection rules
+
+## Resources
+
+- [Git Branch Documentation](https://git-scm.com/docs/git-branch)
+- [Branch Naming Conventions](https://dev.to/varbsan/a-simplified-convention-for-naming-branches-and-commits-in-git-il4)
dots/.config/claude/skills/Git/workflows/Cherry.md
@@ -0,0 +1,500 @@
+# Cherry-Pick Workflow
+
+Apply specific commits from one branch to another.
+
+## When to Use
+
+- "cherry pick commit"
+- "apply specific commit"
+- "copy commit to another branch"
+- "backport fix"
+
+## Quick Commands
+
+### Basic Cherry-Pick
+```bash
+# Cherry-pick single commit
+git cherry-pick abc1234
+
+# Cherry-pick multiple commits
+git cherry-pick abc1234 def5678 ghi9012
+
+# Cherry-pick range of commits (exclusive start)
+git cherry-pick abc1234..def5678
+
+# Cherry-pick range (inclusive)
+git cherry-pick abc1234^..def5678
+
+# Continue after resolving conflicts
+git cherry-pick --continue
+
+# Abort cherry-pick
+git cherry-pick --abort
+
+# Skip current commit
+git cherry-pick --skip
+```
+
+### Cherry-Pick Options
+```bash
+# Cherry-pick without committing
+git cherry-pick -n abc1234
+git cherry-pick --no-commit abc1234
+
+# Cherry-pick with different author
+git cherry-pick abc1234 --edit
+
+# Cherry-pick and add signoff
+git cherry-pick -s abc1234
+git cherry-pick --signoff abc1234
+
+# Keep original author
+git cherry-pick -x abc1234
+# Adds "(cherry picked from commit abc1234)"
+```
+
+## When to Cherry-Pick
+
+### Good Use Cases
+
+**Backporting Bug Fixes**
+```bash
+# Fix was committed to main
+# Need same fix in release branch
+
+git checkout release/v1.0
+git cherry-pick <fix-commit-hash>
+```
+
+**Applying Specific Features**
+```bash
+# Large feature branch, but only need one commit
+# Instead of merging entire branch
+
+git checkout develop
+git cherry-pick <specific-feature-commit>
+```
+
+**Emergency Hotfixes**
+```bash
+# Critical fix needed in multiple branches
+
+git checkout main
+# Fix and commit
+git checkout develop
+git cherry-pick <fix-commit>
+git checkout release/v2.0
+git cherry-pick <fix-commit>
+```
+
+### When NOT to Cherry-Pick
+
+โ **Regular merging**: Use merge or rebase instead
+โ **Multiple dependent commits**: Merge the branch instead
+โ **Entire feature branches**: Use merge
+โ **Maintaining parallel branches**: Use merge to avoid divergence
+
+## Cherry-Pick Process
+
+### Step-by-Step Example
+```bash
+# 1. Find commit to cherry-pick
+git log --oneline feature/auth
+# abc1234 fix: prevent null pointer in login
+
+# 2. Switch to target branch
+git checkout develop
+
+# 3. Cherry-pick the commit
+git cherry-pick abc1234
+
+# 4. If conflicts occur:
+# Auto-merging src/auth.ts
+# CONFLICT (content): Merge conflict in src/auth.ts
+
+# 5. Resolve conflicts
+vim src/auth.ts
+# Fix conflicts manually
+
+# 6. Stage resolved files
+git add src/auth.ts
+
+# 7. Continue cherry-pick
+git cherry-pick --continue
+
+# 8. Verify
+git log -1
+git show HEAD
+```
+
+## Resolving Conflicts
+
+### Conflict Resolution Process
+```bash
+# Cherry-pick causes conflict
+git cherry-pick abc1234
+# CONFLICT (content): Merge conflict in file.txt
+
+# See conflicting files
+git status
+
+# View conflict
+git diff
+
+# Edit and resolve
+vim file.txt
+
+# Stage resolution
+git add file.txt
+
+# Continue
+git cherry-pick --continue
+
+# Or abort if needed
+git cherry-pick --abort
+```
+
+### Conflict Markers
+```javascript
+<<<<<<< HEAD (current branch)
+const API_URL = "https://api.example.com/v1";
+=======
+const API_URL = "https://api.example.com/v2"; // from cherry-picked commit
+>>>>>>> abc1234 (fix: update API version)
+```
+
+Resolve to:
+```javascript
+const API_URL = "https://api.example.com/v2";
+```
+
+## Cherry-Pick Multiple Commits
+
+### Individual Commits
+```bash
+# Cherry-pick multiple specific commits
+git cherry-pick abc1234 def5678 ghi9012
+
+# If conflicts in first commit:
+# Resolve and continue
+git add conflicted-file.txt
+git cherry-pick --continue
+
+# Process continues with next commit
+```
+
+### Commit Range
+```bash
+# Cherry-pick range (abc1234 not included)
+git cherry-pick abc1234..def5678
+
+# Cherry-pick range (abc1234 included)
+git cherry-pick abc1234^..def5678
+
+# View commits that will be picked
+git log --oneline abc1234..def5678
+```
+
+## Cherry-Pick Options
+
+### No Commit (-n)
+```bash
+# Apply changes without committing
+git cherry-pick -n abc1234
+
+# Changes staged but not committed
+git status
+# Changes to be committed:
+# modified: file.txt
+
+# Make additional changes if needed
+vim file.txt
+
+# Commit when ready
+git commit
+```
+
+### Edit Message (-e)
+```bash
+# Cherry-pick and edit commit message
+git cherry-pick -e abc1234
+
+# Opens editor with original message
+# Modify as needed and save
+```
+
+### Add Note (-x)
+```bash
+# Add reference to original commit
+git cherry-pick -x abc1234
+
+# Commit message becomes:
+# fix: original message
+#
+# (cherry picked from commit abc1234def5678...)
+```
+
+### Signoff (-s)
+```bash
+# Add signoff line
+git cherry-pick -s abc1234
+
+# Adds to commit message:
+# Signed-off-by: Your Name <your@email.com>
+```
+
+### Mainline (-m)
+```bash
+# Cherry-pick a merge commit
+# Must specify which parent to follow
+
+git cherry-pick -m 1 <merge-commit>
+# -m 1: Use first parent (usually main branch)
+# -m 2: Use second parent (usually feature branch)
+```
+
+## Common Workflows
+
+### Backport to Release Branch
+```bash
+# Fix committed to main
+git checkout main
+git log --oneline
+# abc1234 fix: critical security issue
+
+# Apply to release branch
+git checkout release/v2.0
+git cherry-pick abc1234
+
+# Add note about backport
+git commit --amend -m "fix: critical security issue
+
+Backported from main (abc1234)
+
+Signed-off-by: Your Name <your@email.com>"
+
+# Push to release
+git push origin release/v2.0
+```
+
+### Selective Feature Migration
+```bash
+# Feature branch has 10 commits
+# Only want commits 3, 5, and 7
+
+git log --oneline feature/new-ui
+# aaa commit 10
+# bbb commit 9
+# ccc commit 8
+# ddd commit 7 โ want this
+# eee commit 6
+# fff commit 5 โ want this
+# ggg commit 4
+# hhh commit 3 โ want this
+# iii commit 2
+# jjj commit 1
+
+git checkout develop
+git cherry-pick hhh fff ddd
+```
+
+### Apply Same Fix to Multiple Branches
+```bash
+# Fix in develop
+git checkout develop
+git commit -m "fix: memory leak in parser"
+# abc1234
+
+# Apply to release branches
+git checkout release/v1.0
+git cherry-pick abc1234
+
+git checkout release/v2.0
+git cherry-pick abc1234
+
+git checkout main
+git cherry-pick abc1234
+```
+
+## Cherry-Pick and Merge Conflicts
+
+### Strategy Selection
+```bash
+# Use recursive strategy with ours/theirs
+git cherry-pick -X ours abc1234 # Prefer current branch
+git cherry-pick -X theirs abc1234 # Prefer cherry-picked changes
+```
+
+### Complex Conflicts
+```bash
+# Start cherry-pick
+git cherry-pick abc1234
+# Multiple conflicts
+
+# Resolve each file
+git status # See all conflicts
+# both modified: file1.txt
+# both modified: file2.txt
+
+# Resolve one by one
+vim file1.txt
+git add file1.txt
+
+vim file2.txt
+git add file2.txt
+
+# Verify all resolved
+git status
+
+# Continue
+git cherry-pick --continue
+```
+
+## Cherry-Pick from Another Repository
+
+### Using Remote
+```bash
+# Add other repository as remote
+git remote add other-repo https://github.com/user/other-repo.git
+
+# Fetch commits
+git fetch other-repo
+
+# Cherry-pick commit
+git cherry-pick other-repo/main~3
+```
+
+### Using Patch
+```bash
+# In source repository
+git format-patch -1 abc1234
+# Creates 0001-commit-message.patch
+
+# Copy patch to target repository
+# In target repository
+git apply 0001-commit-message.patch
+git commit
+```
+
+## Undoing Cherry-Pick
+
+### Before Committing
+```bash
+# Cherry-pick in progress
+git cherry-pick --abort
+```
+
+### After Committing
+```bash
+# Remove last cherry-picked commit
+git reset --hard HEAD~1
+
+# Or revert the cherry-pick
+git revert HEAD
+```
+
+## Cherry-Pick Best Practices
+
+1. **Document the cherry-pick**: Use `-x` flag to add reference
+2. **Test after cherry-pick**: Code may behave differently in target branch
+3. **Prefer merge for features**: Cherry-pick for fixes, not feature development
+4. **Consider dependencies**: Ensure cherry-picked commit doesn't depend on others
+5. **Clean commit history**: Cherry-pick atomic commits, not messy WIP commits
+6. **Communicate with team**: Let others know about cherry-picks to shared branches
+7. **Avoid duplicate commits**: Don't cherry-pick then merge same commits later
+
+## Advanced Techniques
+
+### Cherry-Pick Range Excluding Commits
+```bash
+# Pick all except specific commits
+git cherry-pick main~10..main
+
+# Skip specific commits during range
+git cherry-pick main~10..main
+# When specific commit causes conflict you want to skip:
+git cherry-pick --skip
+```
+
+### Interactive Cherry-Pick
+```bash
+# Cherry-pick without committing
+git cherry-pick -n abc1234
+
+# Review changes
+git diff --staged
+
+# Make modifications
+vim file.txt
+
+# Commit with modified changes
+git commit
+```
+
+### Cherry-Pick Merge Commits
+```bash
+# See merge commit parents
+git show --format="%P" <merge-commit>
+
+# Cherry-pick merge commit
+# -m 1: Use first parent (main branch)
+# -m 2: Use second parent (feature branch)
+git cherry-pick -m 1 <merge-commit>
+```
+
+## Troubleshooting
+
+### Empty Commit
+```bash
+# Cherry-pick results in no changes
+git cherry-pick abc1234
+# The previous cherry-pick is now empty, possibly due to conflict resolution.
+
+# Allow empty commit
+git cherry-pick --allow-empty abc1234
+
+# Or skip
+git cherry-pick --skip
+```
+
+### Wrong Branch
+```bash
+# Cherry-picked to wrong branch
+# Before pushing:
+git reset --hard HEAD~1
+git checkout correct-branch
+git cherry-pick abc1234
+```
+
+### Duplicate Commits
+```bash
+# Find duplicate commits
+git log --oneline --all --graph | grep "same message"
+
+# Avoid by checking before cherry-pick
+git log --oneline | grep "message to cherry-pick"
+```
+
+## Cherry-Pick vs Other Approaches
+
+### Cherry-Pick vs Merge
+| Cherry-Pick | Merge |
+|-------------|-------|
+| Specific commits | Entire branch |
+| Creates new commits | Preserves history |
+| Can cause duplicates | Tracks branch relationships |
+| Good for fixes | Good for features |
+
+### Cherry-Pick vs Rebase
+| Cherry-Pick | Rebase |
+|-------------|--------|
+| Apply to different branch | Replay on same lineage |
+| Select specific commits | All commits |
+| No history rewrite | Rewrites history |
+| Safe for public branches | Risky for public branches |
+
+## Resources
+
+- [Git Cherry-Pick Documentation](https://git-scm.com/docs/git-cherry-pick)
+- [Cherry-Pick Guide](https://www.atlassian.com/git/tutorials/cherry-pick)
+- [When to Cherry-Pick](https://www.git-tower.com/learn/git/faq/cherry-pick)
dots/.config/claude/skills/Git/workflows/Commit.md
@@ -0,0 +1,344 @@
+# Commit Workflow
+
+Create well-structured, meaningful commits following conventional commit standards.
+
+## When to Use
+
+- "create git commit"
+- "commit changes"
+- "write commit message"
+- "amend commit"
+
+## Quick Commands
+
+### Basic Commits
+```bash
+# Stage and commit
+git add file.txt
+git commit -m "feat: add new feature"
+
+# Commit with signoff
+git commit --signoff -m "fix: resolve bug"
+
+# Commit all tracked changes
+git commit -am "chore: update dependencies"
+
+# Use HEREDOC for multi-line messages
+git commit --signoff --message "$(cat <<'EOF'
+feat: add user authentication
+
+- Enable secure sessions with JWT
+- Add login/logout endpoints
+- Implement password hashing
+EOF
+)"
+```
+
+### Viewing Changes Before Commit
+```bash
+# See what will be committed
+git diff --staged
+
+# Review each file
+git diff --staged file.txt
+
+# Check commit status
+git status
+```
+
+## Commit Message Format
+
+### Conventional Commits Structure
+```
+<type>: <short description (max 72 chars)>
+
+- <bullet point describing WHY and IMPACT>
+- <bullet point describing WHY and IMPACT>
+- <bullet point describing WHY and IMPACT>
+
+Signed-off-by: Your Name <your@email.com>
+```
+
+### Commit Types
+- **feat**: New feature
+- **fix**: Bug fix
+- **docs**: Documentation only
+- **style**: Code style (formatting, no logic change)
+- **refactor**: Code restructure (no behavior change)
+- **perf**: Performance improvement
+- **test**: Adding/updating tests
+- **chore**: Maintenance, dependencies, tooling
+- **ci**: CI/CD changes
+
+### Good vs Bad Examples
+
+**Good:**
+```
+feat: add user authentication system
+
+- Enable secure multi-user sessions with JWT tokens
+- Prevent unauthorized API access
+- Lay groundwork for role-based permissions
+
+Signed-off-by: Vincent Demeester <vincent@sbr.pm>
+```
+
+**Bad:**
+```
+added auth stuff
+
+- added login.ts
+- updated config
+```
+
+## Staging Strategies
+
+### Selective Staging
+```bash
+# Stage specific files
+git add src/auth.ts src/types.ts
+
+# Stage by pattern
+git add src/**/*.ts
+
+# Interactive staging
+git add -p
+
+# Stage part of a file (interactive)
+git add -p file.txt
+# Then use: y (yes), n (no), s (split), e (edit)
+```
+
+### Reviewing Before Staging
+```bash
+# See unstaged changes
+git diff
+
+# See what will be staged
+git diff file.txt
+
+# Check status
+git status
+```
+
+## Amending Commits
+
+### When to Amend
+โ
**Safe to amend:**
+- Last commit only
+- Not yet pushed to remote
+- You are the author
+
+โ **Never amend:**
+- Commits already pushed to shared branches
+- Commits authored by others
+- Commits on main/master
+
+### How to Amend
+```bash
+# Check if safe to amend
+git log -1 --format='%an %ae' # Check authorship
+git status # Should show "ahead" not "up to date"
+
+# Amend without changing message
+git add forgotten-file.ts
+git commit --amend --no-edit
+
+# Amend and change message
+git commit --amend
+
+# Amend with new message
+git commit --amend -m "new message"
+```
+
+## Best Practices
+
+### Focus on WHY, Not WHAT
+```bash
+# Bad: Describes WHAT
+git commit -m "add error handling to login function"
+
+# Good: Describes WHY
+git commit -m "fix: prevent crashes when user object is undefined
+
+- Resolve application crashes during invalid login attempts
+- Add defensive checks at authentication boundaries
+
+Signed-off-by: Vincent Demeester <vincent@sbr.pm>"
+```
+
+### Atomic Commits
+```bash
+# One logical change per commit
+
+# Bad: Multiple unrelated changes
+git add src/auth/ src/ui/ docs/
+git commit -m "updates"
+
+# Good: Separate commits
+git add src/auth/
+git commit --signoff -m "feat: add JWT authentication"
+
+git add src/ui/
+git commit --signoff -m "feat: add login form"
+
+git add docs/
+git commit --signoff -m "docs: document authentication flow"
+```
+
+### Commit Often
+```bash
+# Commit at logical checkpoints
+git commit -m "feat: add user model"
+git commit -m "feat: add user repository"
+git commit -m "feat: add user service"
+git commit -m "test: add user service tests"
+```
+
+## Mandatory Requirements
+
+### Always Include
+1. **--signoff flag** (or configure as default)
+2. **Conventional commit type**
+3. **WHY-focused bullet points** (not WHAT)
+
+### Never Include
+- โ Emojis (๐, โจ, etc.)
+- โ Generic messages ("updates", "fixes", "WIP")
+- โ WHAT-focused bullets ("added file X", "changed Y")
+
+## Pre-commit Checks
+
+### Before Committing
+```bash
+# 1. Review what's staged
+git diff --staged
+
+# 2. Check for secrets
+grep -r "API_KEY\|SECRET\|PASSWORD" .
+
+# 3. Run tests
+go test ./... # or npm test, etc.
+
+# 4. Run linters
+golangci-lint run # or eslint, etc.
+
+# 5. Verify no debug code
+grep -r "console.log\|debugger\|TODO" src/
+```
+
+## Interactive Staging
+
+### Patch Mode
+```bash
+# Stage interactively
+git add -p file.txt
+
+# Options:
+# y - stage this hunk
+# n - don't stage this hunk
+# s - split hunk into smaller parts
+# e - manually edit hunk
+# q - quit
+```
+
+### Editing Hunks
+```bash
+# Manually edit what gets staged
+git add -e file.txt
+
+# Or for specific file
+git add -p file.txt
+# Then press 'e' to edit
+```
+
+## Fixing Mistakes
+
+### Unstage Files
+```bash
+# Unstage specific file
+git reset HEAD file.txt
+
+# Unstage all
+git reset HEAD
+
+# New syntax (Git 2.23+)
+git restore --staged file.txt
+```
+
+### Undo Last Commit (Keep Changes)
+```bash
+git reset --soft HEAD~1
+```
+
+### Change Last Commit Message
+```bash
+git commit --amend
+```
+
+## Templates
+
+### Commit Message Template
+Create `.gitmessage`:
+```
+# <type>: <subject> (max 72 chars)
+# |<---- Using a Maximum Of 72 Characters ---->|
+
+# Explain why this change is being made (WHY and IMPACT)
+# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
+
+# --- COMMIT END ---
+# Type can be:
+# feat (new feature)
+# fix (bug fix)
+# refactor (refactoring code)
+# style (formatting, missing semi colons, etc)
+# docs (changes to documentation)
+# test (adding or refactoring tests)
+# chore (maintain)
+```
+
+Configure:
+```bash
+git config --global commit.template ~/.gitmessage
+```
+
+## Git Hooks Integration
+
+### Prepare-commit-msg Hook
+```bash
+# .git/hooks/prepare-commit-msg
+#!/bin/bash
+
+# Add branch name to commit message
+BRANCH_NAME=$(git symbolic-ref --short HEAD)
+if [[ $BRANCH_NAME =~ ^(feat|fix|chore)/ ]]; then
+ TYPE=$(echo $BRANCH_NAME | cut -d'/' -f1)
+ echo "$TYPE: " > "$1.tmp"
+ cat "$1" >> "$1.tmp"
+ mv "$1.tmp" "$1"
+fi
+```
+
+## Configuration
+
+### Useful Git Config
+```bash
+# Always signoff commits
+git config --global format.signoff true
+
+# Set commit template
+git config --global commit.template ~/.gitmessage
+
+# Verbose commit (shows diff)
+git config --global commit.verbose true
+
+# Set default editor
+git config --global core.editor vim
+```
+
+## Resources
+
+- [Conventional Commits](https://www.conventionalcommits.org/)
+- [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/)
+- [Git Commit Best Practices](https://github.com/trein/dev-best-practices/wiki/Git-Commit-Best-Practices)
dots/.config/claude/skills/Git/workflows/Merge.md
@@ -0,0 +1,287 @@
+# Merge Workflow
+
+Merge branches with proper strategies and conflict resolution.
+
+## When to Use
+
+- "merge git branch"
+- "merge conflicts"
+- "resolve conflicts"
+- "merge strategies"
+
+## Quick Commands
+
+### Basic Merge
+```bash
+# Merge feature branch into current branch
+git merge feature/user-auth
+
+# Merge with commit message
+git merge feature/user-auth -m "Merge user authentication feature"
+
+# No fast-forward (always create merge commit)
+git merge --no-ff feature/user-auth
+
+# Abort merge
+git merge --abort
+```
+
+### Merge Strategies
+
+```bash
+# Fast-forward only (fail if not possible)
+git merge --ff-only feature/user-auth
+
+# Squash merge (combine all commits)
+git merge --squash feature/user-auth
+git commit -m "feat: add user authentication"
+
+# No commit (stage changes only)
+git merge --no-commit feature/user-auth
+```
+
+## Merge vs Fast-Forward
+
+### Fast-Forward Merge
+```bash
+# When feature is ahead of main, no divergence
+git checkout main
+git merge feature/simple-fix
+
+# Result: main pointer moves forward, no merge commit
+# main: A---B
+# feature: C---D
+# After: A---B---C---D (main)
+```
+
+### Three-Way Merge
+```bash
+# When both branches have diverged
+git checkout main
+git merge feature/complex-feature
+
+# Result: creates merge commit
+# main: A---B-------E (merge commit)
+# \ /
+# feature: C---D
+```
+
+## Resolving Conflicts
+
+### Conflict Resolution Process
+```bash
+# 1. Attempt merge
+git merge feature/user-auth
+# Auto-merging file.txt
+# CONFLICT (content): Merge conflict in file.txt
+
+# 2. See conflicting files
+git status
+# Unmerged paths:
+# both modified: file.txt
+
+# 3. View conflicts
+git diff
+
+# 4. Edit file to resolve
+# Remove conflict markers and choose resolution
+
+# 5. Stage resolved files
+git add file.txt
+
+# 6. Complete merge
+git commit
+
+# Or abort
+git merge --abort
+```
+
+### Conflict Markers
+```
+<<<<<<< HEAD (current branch)
+const API_URL = "https://api.example.com/v1";
+=======
+const API_URL = "https://api.example.com/v2";
+>>>>>>> feature/api-update
+```
+
+### Resolution Options
+```javascript
+// Option 1: Keep current
+const API_URL = "https://api.example.com/v1";
+
+// Option 2: Take incoming
+const API_URL = "https://api.example.com/v2";
+
+// Option 3: Combine both
+const API_URL = process.env.API_VERSION === "2"
+ ? "https://api.example.com/v2"
+ : "https://api.example.com/v1";
+```
+
+## Merge Tools
+
+### Using Merge Tool
+```bash
+# Configure merge tool
+git config --global merge.tool vimdiff
+
+# Run merge tool for conflicts
+git mergetool
+
+# Common merge tools:
+# - vimdiff
+# - meld
+# - kdiff3
+# - p4merge
+# - code (VS Code)
+```
+
+### VS Code as Merge Tool
+```bash
+git config --global merge.tool vscode
+git config --global mergetool.vscode.cmd 'code --wait $MERGED'
+```
+
+## Merge Strategies
+
+### Recursive (Default)
+```bash
+# Default for two branches
+git merge -s recursive feature/branch
+```
+
+### Ours/Theirs
+```bash
+# Keep our version on conflict
+git merge -X ours feature/branch
+
+# Keep their version on conflict
+git merge -X theirs feature/branch
+```
+
+### Octopus
+```bash
+# Merge multiple branches at once
+git merge feature/auth feature/api feature/ui
+```
+
+## Squash Merge
+
+### When to Use
+- Feature branch with many small commits
+- Want clean main branch history
+- Don't need to preserve individual commits
+
+### How to Squash Merge
+```bash
+# 1. Squash merge
+git checkout main
+git merge --squash feature/many-commits
+
+# 2. All changes staged, no commit created
+git status
+
+# 3. Create single commit
+git commit -m "feat: complete user authentication
+
+- Add login/logout functionality
+- Implement JWT token management
+- Add password hashing
+- Create user session handling"
+```
+
+## Cherry-Pick During Merge
+
+```bash
+# If you want specific commits instead of full merge
+git cherry-pick abc1234 def5678
+```
+
+## Undoing Merges
+
+### Before Committing
+```bash
+# Abort in-progress merge
+git merge --abort
+
+# Reset staged changes
+git reset --hard HEAD
+```
+
+### After Committing
+```bash
+# Undo merge commit (keep changes)
+git reset --soft HEAD~1
+
+# Undo merge commit (discard changes)
+git reset --hard HEAD~1
+
+# Revert merge (safe for public branches)
+git revert -m 1 HEAD
+# -m 1 means keep main branch side
+```
+
+## Best Practices
+
+1. **Always pull before merge**: Ensure you have latest changes
+2. **Merge into correct branch**: Double-check current branch
+3. **Test before merging**: Run tests on feature branch first
+4. **Use --no-ff for features**: Preserve branch history
+5. **Squash for cleanup**: Use squash merge for messy branches
+6. **Communicate conflicts**: Discuss non-trivial resolutions
+7. **Never merge broken code**: Ensure tests pass first
+
+## Common Workflows
+
+### Feature Branch Merge
+```bash
+# 1. Update main
+git checkout main
+git pull
+
+# 2. Merge feature
+git merge --no-ff feature/user-auth
+
+# 3. Push
+git push
+```
+
+### Hotfix Merge
+```bash
+# 1. Create hotfix from main
+git checkout -b hotfix/security-patch main
+
+# 2. Fix and commit
+git commit -m "fix: security vulnerability"
+
+# 3. Merge to main
+git checkout main
+git merge --no-ff hotfix/security-patch
+
+# 4. Tag release
+git tag -a v1.0.1 -m "Security patch"
+
+# 5. Merge to develop if exists
+git checkout develop
+git merge --no-ff hotfix/security-patch
+```
+
+## Configuration
+
+```bash
+# Always create merge commit (no fast-forward)
+git config --global merge.ff false
+
+# For pull specifically
+git config --global pull.ff only
+
+# Show conflict style
+git config --global merge.conflictstyle diff3
+```
+
+## Resources
+
+- [Git Merge Documentation](https://git-scm.com/docs/git-merge)
+- [Resolving Conflicts](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging#_basic_merge_conflicts)
+- [Merge Strategies](https://git-scm.com/docs/merge-strategies)
dots/.config/claude/skills/Git/workflows/Rebase.md
@@ -0,0 +1,252 @@
+# Rebase Workflow
+
+Rebase commits for a cleaner history and easier code review.
+
+## When to Use
+
+- "rebase git branch"
+- "interactive rebase"
+- "clean up commits"
+- "rebase on main"
+
+## Quick Commands
+
+### Basic Rebase
+```bash
+# Rebase current branch on main
+git rebase main
+
+# Rebase on remote main
+git fetch origin
+git rebase origin/main
+
+# Continue after resolving conflicts
+git rebase --continue
+
+# Skip current commit
+git rebase --skip
+
+# Abort rebase
+git rebase --abort
+```
+
+### Interactive Rebase
+```bash
+# Rebase last 3 commits
+git rebase -i HEAD~3
+
+# Rebase all commits on main
+git rebase -i main
+
+# Rebase from specific commit
+git rebase -i abc1234
+```
+
+## Interactive Rebase Commands
+
+```
+pick - keep commit as-is
+reword - change commit message
+edit - stop to amend commit
+squash - merge into previous commit (keep both messages)
+fixup - merge into previous commit (discard this message)
+drop - remove commit
+```
+
+### Example Interactive Rebase
+```bash
+# Start interactive rebase
+git rebase -i HEAD~4
+
+# Editor shows:
+pick a1b2c3d feat: add user model
+pick d4e5f6g fix: typo in user model
+pick g7h8i9j feat: add user repository
+pick j0k1l2m test: add user tests
+
+# Change to:
+pick a1b2c3d feat: add user model
+fixup d4e5f6g fix: typo in user model
+pick g7h8i9j feat: add user repository
+pick j0k1l2m test: add user tests
+
+# Result: 4 commits โ 3 commits (typo fix merged into original)
+```
+
+## Resolving Conflicts
+
+### Conflict Resolution Process
+```bash
+# 1. Rebase encounters conflict
+git rebase origin/main
+# CONFLICT (content): Merge conflict in file.txt
+
+# 2. See conflicting files
+git status
+
+# 3. Edit files to resolve conflicts
+# Remove conflict markers: <<<<<<<, =======, >>>>>>>
+
+# 4. Stage resolved files
+git add file.txt
+
+# 5. Continue rebase
+git rebase --continue
+
+# 6. Repeat if more conflicts
+```
+
+### Conflict Markers
+```
+<<<<<<< HEAD (your changes)
+const name = "Alice";
+=======
+const name = "Bob";
+>>>>>>> abc1234 (incoming changes)
+```
+
+Resolve to:
+```javascript
+const name = "Alice"; // or "Bob", or merge both
+```
+
+## Common Rebase Scenarios
+
+### Update Feature Branch
+```bash
+# Keep feature branch up to date with main
+git checkout feature/my-feature
+git fetch origin
+git rebase origin/main
+
+# If conflicts, resolve and continue
+git add resolved-file.txt
+git rebase --continue
+```
+
+### Squash Commits Before Merge
+```bash
+# Squash all commits into one
+git rebase -i main
+
+# In editor, mark all but first as 'squash' or 'fixup'
+pick abc1234 feat: initial implementation
+squash def5678 fix: address review comments
+squash ghi9012 fix: another typo
+
+# Results in single clean commit
+```
+
+### Split a Commit
+```bash
+# Start interactive rebase
+git rebase -i HEAD~3
+
+# Mark commit as 'edit'
+edit abc1234 feat: add multiple features
+
+# When rebase stops
+git reset HEAD^ # Unstage everything
+git add file1.txt
+git commit -m "feat: add feature 1"
+git add file2.txt
+git commit -m "feat: add feature 2"
+
+# Continue rebase
+git rebase --continue
+```
+
+## Rebase vs Merge
+
+### Use Rebase When
+- Working on feature branch
+- Want linear history
+- Haven't pushed yet (or force push is acceptable)
+- Cleaning up commits before PR
+
+### Use Merge When
+- On main/master branch
+- Commits already pushed to shared branch
+- Want to preserve exact history
+- Multiple people working on same branch
+
+## Force Push After Rebase
+
+```bash
+# Rebase rewrites history, requires force push
+git push --force-with-lease
+
+# Safer than --force (checks remote hasn't changed)
+# Recommended over:
+git push --force # Dangerous, can overwrite others' work
+```
+
+## Rebase Safety
+
+### Before Rebasing
+```bash
+# 1. Check you're on correct branch
+git branch --show-current
+
+# 2. Commit or stash changes
+git status
+git stash # if needed
+
+# 3. Fetch latest changes
+git fetch origin
+
+# 4. Create backup branch (optional but safe)
+git branch backup-$(git branch --show-current)
+```
+
+### Recovery If Needed
+```bash
+# Find lost commits
+git reflog
+
+# Recover to previous state
+git reset --hard HEAD@{5} # or specific commit
+
+# Restore from backup branch
+git reset --hard backup-feature-branch
+```
+
+## Best Practices
+
+1. **Never rebase public branches**: Don't rebase main/master
+2. **Rebase before pushing**: Clean up local commits first
+3. **Use --force-with-lease**: Safer than --force
+4. **Communicate with team**: If rebasing shared branch
+5. **Fetch before rebase**: Ensure you have latest changes
+6. **Test after rebase**: Run tests to ensure nothing broken
+7. **One logical change per commit**: Makes rebasing easier
+
+## Advanced Techniques
+
+### Autosquash
+```bash
+# Create fixup commit
+git commit --fixup=abc1234
+
+# Rebase with autosquash
+git rebase -i --autosquash main
+# Automatically marks fixup commits
+```
+
+### Preserve Merge Commits
+```bash
+# Rebase keeping merge commits
+git rebase --rebase-merges main
+```
+
+### Rebase Onto
+```bash
+# Move commits to different base
+git rebase --onto main feature-a feature-b
+```
+
+## Resources
+
+- [Git Rebase Documentation](https://git-scm.com/docs/git-rebase)
+- [Rewriting History](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)
+- [Merging vs Rebasing](https://www.atlassian.com/git/tutorials/merging-vs-rebasing)
dots/.config/claude/skills/Git/workflows/Reset.md
@@ -0,0 +1,461 @@
+# Reset Workflow
+
+Undo changes and move branch pointers using Git reset.
+
+## When to Use
+
+- "undo git commit"
+- "reset git branch"
+- "discard changes"
+- "move branch pointer"
+
+## Quick Commands
+
+### Basic Reset
+```bash
+# Undo last commit, keep changes staged
+git reset --soft HEAD~1
+
+# Undo last commit, keep changes unstaged
+git reset --mixed HEAD~1
+git reset HEAD~1 # mixed is default
+
+# Undo last commit, discard all changes
+git reset --hard HEAD~1
+
+# Reset to specific commit
+git reset --hard abc1234
+
+# Unstage files
+git reset HEAD file.txt
+git reset # Unstage all
+```
+
+## Reset Modes
+
+### --soft (Keep Everything)
+```bash
+# Undo commit, keep changes staged
+git reset --soft HEAD~1
+
+# Result:
+# - Commit removed from history
+# - Changes stay staged
+# - Working directory unchanged
+
+# Use case: Redo commit with different message
+git reset --soft HEAD~1
+git commit -m "better message"
+```
+
+### --mixed (Keep Working Changes)
+```bash
+# Undo commit, unstage changes
+git reset --mixed HEAD~1
+git reset HEAD~1 # Same (default mode)
+
+# Result:
+# - Commit removed from history
+# - Changes unstaged
+# - Working directory unchanged
+
+# Use case: Re-stage files differently
+git reset HEAD~1
+git add specific-files.txt
+git commit
+```
+
+### --hard (Discard Everything)
+```bash
+# Undo commit, discard all changes
+git reset --hard HEAD~1
+
+# Result:
+# - Commit removed from history
+# - Staging area cleared
+# - Working directory reverted
+
+# โ ๏ธ WARNING: Loses uncommitted changes!
+
+# Use case: Completely abandon recent work
+git reset --hard HEAD~1
+```
+
+## Common Use Cases
+
+### Undo Last Commit (Keep Changes)
+```bash
+# Made commit too early
+git commit -m "incomplete work"
+
+# Undo commit, keep changes staged
+git reset --soft HEAD~1
+
+# Continue working
+vim file.txt
+git add .
+git commit -m "complete work"
+```
+
+### Undo Multiple Commits
+```bash
+# Undo last 3 commits, keep changes
+git reset --soft HEAD~3
+
+# Or undo to specific commit
+git reset --soft abc1234
+
+# All changes from 3 commits now staged
+git status
+```
+
+### Unstage Files
+```bash
+# Staged wrong files
+git add .
+git status
+# Changes to be committed:
+# modified: wanted.txt
+# modified: unwanted.txt
+
+# Unstage specific file
+git reset HEAD unwanted.txt
+
+# Or unstage all
+git reset HEAD
+```
+
+### Discard All Local Changes
+```bash
+# Working directory is messy
+# Want to start fresh from last commit
+
+git reset --hard HEAD
+
+# โ ๏ธ All uncommitted changes lost!
+```
+
+### Move Branch to Different Commit
+```bash
+# Branch points to wrong commit
+git reset --hard abc1234
+
+# Branch now points to abc1234
+# All commits after abc1234 are "removed"
+# (recoverable via reflog)
+```
+
+## Reset Safety
+
+### Before Using --hard
+```bash
+# Check what will be lost
+git diff HEAD
+git status
+
+# Create backup branch
+git branch backup-before-reset
+
+# Now safe to reset
+git reset --hard HEAD~5
+
+# If needed, restore
+git reset --hard backup-before-reset
+```
+
+### Recovering from Reset
+```bash
+# Find lost commits
+git reflog
+# abc1234 HEAD@{0}: reset: moving to HEAD~3
+# def5678 HEAD@{1}: commit: important work
+# ghi9012 HEAD@{2}: commit: more work
+
+# Restore to before reset
+git reset --hard HEAD@{1}
+# Or
+git reset --hard def5678
+```
+
+## Reset vs Revert
+
+### Reset (Rewrite History)
+```bash
+# Remove commits from history
+git reset --hard HEAD~2
+
+# โ ๏ธ Changes history
+# โ Clean history
+# โ Dangerous on shared branches
+```
+
+### Revert (Preserve History)
+```bash
+# Create new commit that undoes changes
+git revert HEAD
+
+# โ Safe for shared branches
+# โ Preserves history
+# โ Creates additional commit
+```
+
+### When to Use Each
+| Scenario | Use Reset | Use Revert |
+|----------|-----------|------------|
+| Local commits not pushed | โ | |
+| Already pushed to shared branch | | โ |
+| Want clean history | โ | |
+| Want to preserve history | | โ |
+| Undoing merge commits | | โ |
+
+## Reset Specific Files
+
+### Unstage Files
+```bash
+# Unstage specific file
+git reset HEAD file.txt
+
+# Unstage all files
+git reset HEAD
+
+# New syntax (Git 2.23+)
+git restore --staged file.txt
+```
+
+### Reset File to Specific Commit
+```bash
+# Reset file to version from 3 commits ago
+git reset HEAD~3 -- file.txt
+
+# File changes staged
+# Commit or discard as needed
+git commit -m "restore old version of file"
+```
+
+## Reset with Paths
+
+### Reset Specific Files to HEAD
+```bash
+# Discard changes to specific file
+git reset --hard HEAD -- file.txt
+
+# Better alternative (clearer intent):
+git checkout HEAD -- file.txt
+# Or (Git 2.23+):
+git restore file.txt
+```
+
+## Advanced Reset Techniques
+
+### Reset and Squash
+```bash
+# Squash last 5 commits into one
+git reset --soft HEAD~5
+git commit -m "squashed commit message"
+```
+
+### Partial Reset
+```bash
+# Reset some files, keep others
+git reset HEAD~1 -- src/
+# Only src/ files reset, rest unchanged
+```
+
+### Reset to Remote
+```bash
+# Discard all local commits, match remote
+git fetch origin
+git reset --hard origin/main
+
+# โ ๏ธ Loses all local commits!
+```
+
+## Reset Scenarios
+
+### Wrong Branch
+```bash
+# Made commits on main instead of feature branch
+git branch feature/my-work # Save work
+git reset --hard origin/main # Reset main
+git checkout feature/my-work # Continue on feature
+```
+
+### Undo Merge
+```bash
+# Just merged but it was wrong
+git reset --hard HEAD~1
+
+# Or if merge not committed yet
+git merge --abort
+```
+
+### Clean Slate
+```bash
+# Want to completely match remote
+git fetch origin
+git reset --hard origin/main
+git clean -fdx # Also remove untracked files
+```
+
+## Reset and Reflog
+
+### Viewing Reflog
+```bash
+# See all HEAD movements
+git reflog
+
+# Output:
+# abc1234 HEAD@{0}: reset: moving to HEAD~3
+# def5678 HEAD@{1}: commit: important work
+# ghi9012 HEAD@{2}: commit: feature added
+```
+
+### Recovering Lost Commits
+```bash
+# After bad reset
+git reset --hard HEAD~10
+# Oh no! Lost important work
+
+# Find it in reflog
+git reflog
+# def5678 HEAD@{1}: commit: important work
+
+# Restore
+git reset --hard def5678
+# Or
+git reset --hard HEAD@{1}
+```
+
+### Reflog Expiration
+```bash
+# Reflog keeps history for 90 days (default)
+# After that, commits are garbage collected
+
+# Immediately expire reflog (dangerous!)
+git reflog expire --expire=now --all
+git gc --prune=now
+```
+
+## Reset Best Practices
+
+1. **Never reset public branches**: Don't reset commits pushed to shared branches
+2. **Use --soft for commit cleanup**: Safest way to redo commits
+3. **Create backup before --hard**: Use backup branch or check reflog
+4. **Prefer revert for public branches**: Safer than reset for shared history
+5. **Check diff before --hard**: Know what you're losing
+6. **Communicate resets on shared branches**: Team needs to know
+7. **Use --force-with-lease after reset**: Safer than --force when pushing
+
+## Dangerous Reset Patterns
+
+### โ Reset Public Branch
+```bash
+# BAD: Others have this commit
+git reset --hard HEAD~5
+git push --force origin main
+# Other developers' work now conflicts
+```
+
+### โ Reset Without Checking
+```bash
+# BAD: Don't know what's being lost
+git reset --hard HEAD~10
+# Oops, lost important work
+```
+
+### โ Safe Alternative
+```bash
+# GOOD: Create backup first
+git branch backup-main
+git reset --hard HEAD~10
+
+# Can restore if needed
+git reset --hard backup-main
+```
+
+## Reset and Push
+
+### After Local Reset
+```bash
+# Reset local commits
+git reset --hard HEAD~3
+
+# Try to push
+git push
+# error: Updates were rejected
+
+# Must force push (dangerous!)
+git push --force-with-lease
+```
+
+### Force Push Safety
+```bash
+# Safer than --force (checks remote hasn't changed)
+git push --force-with-lease
+
+# Protects against overwriting others' work
+```
+
+## Reset Alternatives
+
+### For Committed Changes
+```bash
+# Instead of reset --hard
+# Use revert (safe for shared branches)
+git revert HEAD
+```
+
+### For Uncommitted Changes
+```bash
+# Instead of reset --hard
+# Use stash (recoverable)
+git stash
+git stash drop # If sure you don't need it
+```
+
+### For Specific Files
+```bash
+# Instead of reset --hard file.txt
+# Use restore (clearer intent, Git 2.23+)
+git restore file.txt
+git restore --staged file.txt
+```
+
+## Configuration
+
+```bash
+# Require explicit mode for reset
+git config --global advice.resetNoMode true
+
+# Always show what reset will do
+git config --global advice.resetQuiet false
+```
+
+## Emergency Recovery
+
+### Lost Commits
+```bash
+# Find all unreachable commits
+git fsck --lost-found
+
+# Or search reflog
+git reflog --all | grep "search term"
+
+# Recover specific commit
+git cherry-pick <lost-commit-hash>
+```
+
+### Completely Destroyed Branch
+```bash
+# Find branch in reflog
+git reflog show feature/my-work
+
+# Restore branch
+git checkout -b feature/my-work-recovered <commit-hash>
+```
+
+## Resources
+
+- [Git Reset Documentation](https://git-scm.com/docs/git-reset)
+- [Reset, Checkout, and Revert](https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting)
+- [Undoing Changes in Git](https://git-scm.com/book/en/v2/Git-Basics-Undoing-Things)
dots/.config/claude/skills/Git/workflows/Stash.md
@@ -0,0 +1,313 @@
+# Stash Workflow
+
+Temporarily save changes without committing.
+
+## When to Use
+
+- "stash git changes"
+- "save work in progress"
+- "temporarily save changes"
+- "switch branches with uncommitted changes"
+
+## Quick Commands
+
+### Basic Stash
+```bash
+# Stash current changes
+git stash
+
+# Stash with message
+git stash push -m "WIP: working on auth feature"
+
+# Stash including untracked files
+git stash -u
+
+# Stash including untracked and ignored files
+git stash -a
+
+# Stash specific files
+git stash push -m "temp changes" file1.txt file2.txt
+```
+
+### Viewing Stashes
+```bash
+# List all stashes
+git stash list
+
+# Show stash contents
+git stash show
+
+# Show specific stash
+git stash show stash@{1}
+
+# Show diff
+git stash show -p
+git stash show -p stash@{1}
+```
+
+### Applying Stashes
+```bash
+# Apply most recent stash (keep stash)
+git stash apply
+
+# Apply specific stash
+git stash apply stash@{2}
+
+# Apply and remove stash
+git stash pop
+
+# Apply specific and remove
+git stash pop stash@{1}
+```
+
+### Managing Stashes
+```bash
+# Delete specific stash
+git stash drop stash@{0}
+
+# Delete all stashes
+git stash clear
+
+# Create branch from stash
+git stash branch feature/new-work stash@{0}
+```
+
+## Common Use Cases
+
+### Quick Context Switch
+```bash
+# You're working on feature A
+# Urgent bug needs fixing
+
+# 1. Stash current work
+git stash push -m "WIP: feature A implementation"
+
+# 2. Switch to main and create hotfix
+git checkout main
+git checkout -b hotfix/urgent-bug
+
+# 3. Fix, commit, and merge
+git commit -m "fix: urgent bug"
+git checkout main
+git merge hotfix/urgent-bug
+
+# 4. Return to feature A
+git checkout feature/a
+git stash pop
+```
+
+### Pull with Uncommitted Changes
+```bash
+# You have uncommitted changes
+# Need to pull latest updates
+
+# 1. Stash changes
+git stash
+
+# 2. Pull
+git pull
+
+# 3. Reapply changes
+git stash pop
+
+# Handle conflicts if any
+```
+
+### Try Experimental Changes
+```bash
+# Stash current stable work
+git stash push -m "stable implementation"
+
+# Try experimental approach
+# ... make changes ...
+
+# If experiment fails, restore stable
+git reset --hard HEAD
+git stash pop
+
+# If experiment works, keep it and drop stash
+git stash drop
+```
+
+## Stash with Partial Changes
+
+### Interactive Stash
+```bash
+# Stash interactively (like git add -p)
+git stash -p
+
+# For each hunk:
+# y - stash this hunk
+# n - don't stash this hunk
+# s - split into smaller hunks
+# q - quit
+```
+
+### Stash Specific Files
+```bash
+# Stash only certain files
+git stash push -m "temp API changes" src/api.ts src/types.ts
+
+# Stash everything except certain files
+git stash push -- src/
+```
+
+## Working with Multiple Stashes
+
+### Organized Stash Management
+```bash
+# Create named stashes
+git stash push -m "feature: user auth half done"
+git stash push -m "experiment: alternative approach"
+git stash push -m "bugfix: in progress"
+
+# List with messages
+git stash list
+# stash@{0}: On main: bugfix: in progress
+# stash@{1}: On main: experiment: alternative approach
+# stash@{2}: On main: feature: user auth half done
+
+# Apply specific stash
+git stash apply stash@{2}
+```
+
+### Creating Branches from Stashes
+```bash
+# Create branch and apply stash
+git stash branch feature/auth-completion stash@{0}
+
+# This:
+# 1. Creates new branch
+# 2. Checks it out
+# 3. Applies stash
+# 4. Drops stash if successful
+```
+
+## Stash Conflicts
+
+### Resolving Stash Conflicts
+```bash
+# When applying stash causes conflicts
+git stash pop
+# CONFLICT (content): Merge conflict in file.txt
+
+# 1. Resolve conflicts manually
+# 2. Stage resolved files
+git add file.txt
+
+# 3. No need to commit, changes are in working directory
+# Stash is already removed by pop
+
+# If you used apply instead:
+git stash drop stash@{0}
+```
+
+## Advanced Stash Techniques
+
+### Stash Keeping Index
+```bash
+# Stash unstaged changes, keep staged
+git stash --keep-index
+
+# Useful when you want to:
+# 1. Keep staged changes
+# 2. Temporarily remove unstaged
+# 3. Run tests on staged only
+```
+
+### Stash Untracked Files Only
+```bash
+# Stash only untracked files
+git stash -u --keep-index
+```
+
+### Recover Dropped Stash
+```bash
+# If you accidentally dropped a stash
+# Find it in reflog
+git fsck --unreachable | grep commit | cut -d' ' -f3 | xargs git log --merges --no-walk --grep=WIP
+
+# Or
+git log --graph --oneline --decorate $(git fsck --no-reflog | awk '/dangling commit/ {print $3}')
+
+# Recover with:
+git stash apply <commit-hash>
+```
+
+## Stash Workflow Patterns
+
+### Daily Work Pattern
+```bash
+# End of day
+git stash push -m "EOD: $(date +%Y-%m-%d) work in progress"
+
+# Start of day
+git stash list # Review what was stashed
+git stash pop # Continue work
+```
+
+### Code Review Pattern
+```bash
+# You're working on feature
+git stash push -m "WIP: before code review"
+
+# Check out PR for review
+git fetch origin pull/123/head:pr-123
+git checkout pr-123
+# Review...
+
+# Return to your work
+git checkout feature/my-work
+git stash pop
+```
+
+## Best Practices
+
+1. **Always use messages**: `git stash push -m "description"`
+2. **Clean up old stashes**: Review and drop unneeded stashes
+3. **Prefer commits over stash**: For long-term work
+4. **Use branches for experiments**: Better than multiple stashes
+5. **Pop when you can**: Don't accumulate many stashes
+6. **Include untracked with -u**: If you have new files
+7. **Review before popping**: Check stash contents first
+
+## Common Pitfalls
+
+### Forgetting About Stashes
+```bash
+# Regularly check for stashes
+git stash list
+
+# If you see old ones, review and clean up
+git stash show stash@{0}
+git stash drop stash@{0}
+```
+
+### Stashing on Wrong Branch
+```bash
+# If you stashed on wrong branch
+# 1. Go to correct branch
+git checkout correct-branch
+
+# 2. Apply stash from other branch
+git stash apply stash@{0}
+
+# 3. Go back and drop from original
+git checkout original-branch
+git stash drop stash@{0}
+```
+
+## Configuration
+
+```bash
+# Show untracked files in stash show
+git config --global stash.showIncludeUntracked true
+
+# Show stash in git log
+git config --global log.showSignature false
+```
+
+## Resources
+
+- [Git Stash Documentation](https://git-scm.com/docs/git-stash)
+- [Stashing and Cleaning](https://git-scm.com/book/en/v2/Git-Tools-Stashing-and-Cleaning)
dots/.config/claude/skills/Git/workflows/Worktree.md
@@ -0,0 +1,500 @@
+# Worktree Workflow
+
+Work on multiple branches simultaneously using Git worktrees.
+
+## When to Use
+
+- "work on multiple branches"
+- "git worktree"
+- "parallel development"
+- "test multiple versions"
+
+## Quick Commands
+
+### Creating Worktrees
+```bash
+# Create worktree for new branch
+git worktree add ../my-project-feature feature/new-feature
+
+# Create worktree from existing branch
+git worktree add ../my-project-bugfix bugfix/issue-123
+
+# Create worktree with new branch from current
+git worktree add -b feature/experiment ../my-project-exp
+
+# Create temporary worktree
+git worktree add --detach ../my-project-temp HEAD~5
+```
+
+### Managing Worktrees
+```bash
+# List all worktrees
+git worktree list
+
+# Remove worktree
+git worktree remove ../my-project-feature
+
+# Remove and prune
+git worktree prune
+
+# Move worktree
+git worktree move ../old-location ../new-location
+```
+
+## What Are Worktrees?
+
+### Traditional Workflow Problem
+```bash
+# Working on feature
+vim src/auth.ts
+
+# Urgent bug needs fixing
+git stash # Save work
+git checkout main # Switch branch
+git checkout -b hotfix/urgent
+# Fix bug...
+git checkout feature/auth
+git stash pop # Restore work
+
+# Lots of context switching!
+```
+
+### Worktree Solution
+```bash
+# Main checkout
+~/projects/myapp (feature/auth)
+
+# Create worktree for hotfix
+git worktree add ../myapp-hotfix hotfix/urgent
+
+# Now you have two directories:
+# ~/projects/myapp (feature/auth)
+# ~/projects/myapp-hotfix (hotfix/urgent)
+
+# Work in both simultaneously!
+cd ../myapp-hotfix
+# Fix bug...
+git commit
+git push
+
+# Return to feature work
+cd ~/projects/myapp
+# Continue where you left off, no stash needed
+```
+
+## Basic Worktree Operations
+
+### Create Worktree
+```bash
+# Create worktree for existing branch
+git worktree add ../myapp-develop develop
+
+# Create worktree with new branch
+git worktree add -b feature/new-ui ../myapp-ui
+
+# Create from specific commit
+git worktree add ../myapp-v1 v1.0.0
+
+# Create detached HEAD (no branch)
+git worktree add --detach ../myapp-temp abc1234
+```
+
+### List Worktrees
+```bash
+# Show all worktrees
+git worktree list
+
+# Output:
+# /home/user/myapp abc1234 [main]
+# /home/user/myapp-dev def5678 [develop]
+# /home/user/myapp-hotfix ghi9012 [hotfix/urgent]
+
+# Verbose output
+git worktree list --porcelain
+```
+
+### Remove Worktree
+```bash
+# Remove worktree (directory must be clean)
+git worktree remove ../myapp-hotfix
+
+# Force remove (even with uncommitted changes)
+git worktree remove --force ../myapp-hotfix
+
+# Remove worktree directory manually
+rm -rf ../myapp-hotfix
+# Then clean up Git's internal state
+git worktree prune
+```
+
+## Common Use Cases
+
+### Parallel Feature Development
+```bash
+# Main feature work
+~/projects/myapp (feature/user-auth)
+
+# Create worktree for related feature
+git worktree add -b feature/user-profile ../myapp-profile
+
+# Work on both features simultaneously
+cd ../myapp-profile
+# Implement user profile
+git commit
+
+cd ~/projects/myapp
+# Continue auth work
+```
+
+### Code Review
+```bash
+# Continue working on your feature
+~/projects/myapp (feature/my-work)
+
+# Create worktree to review PR
+git fetch origin pull/123/head:pr-123
+git worktree add ../myapp-review pr-123
+
+# Review in separate directory
+cd ../myapp-review
+# Test, read code...
+
+# No need to stash or commit WIP
+# Your main work directory unchanged
+```
+
+### Testing Branches
+```bash
+# Create worktree for testing
+git worktree add ../myapp-test feature/experimental
+
+cd ../myapp-test
+npm install
+npm test
+npm start # Test in browser
+
+# If it works, merge from main worktree
+cd ~/projects/myapp
+git merge feature/experimental
+
+# If it doesn't work, just remove
+git worktree remove ../myapp-test
+```
+
+### Release Preparation
+```bash
+# Main development continues
+~/projects/myapp (develop)
+
+# Create worktree for release
+git worktree add -b release/v2.0 ../myapp-release
+
+cd ../myapp-release
+# Prepare release: version bumps, changelog
+git commit -m "chore: prepare v2.0 release"
+
+# Development continues in main worktree
+cd ~/projects/myapp
+# Continue feature work uninterrupted
+```
+
+## Worktree Directory Structure
+
+### Recommended Layout
+```bash
+~/projects/myapp/
+ .git/
+ main/ # main branch
+ worktrees/
+ develop/ # develop branch
+ feature-x/ # feature branch
+ hotfix/ # hotfix branch
+```
+
+### Creating Organized Structure
+```bash
+# From main repository
+cd ~/projects/myapp
+
+# Create worktree subdirectory
+mkdir -p worktrees
+
+# Add worktrees to subdirectory
+git worktree add worktrees/develop develop
+git worktree add -b feature/ui worktrees/feature-ui
+```
+
+## Worktree Best Practices
+
+### Naming Conventions
+```bash
+# Use descriptive names matching branch
+git worktree add ../myapp-feature-auth feature/auth
+git worktree add ../myapp-bugfix-login bugfix/login-error
+git worktree add ../myapp-release-v2 release/v2.0
+
+# Or use prefix pattern
+git worktree add ../feature-auth feature/auth
+git worktree add ../bugfix-login bugfix/login-error
+```
+
+### Cleanup Strategy
+```bash
+# Regularly review worktrees
+git worktree list
+
+# Remove finished worktrees
+git worktree remove ../myapp-feature-done
+
+# Prune stale references
+git worktree prune
+
+# Script to clean old worktrees
+#!/bin/bash
+git worktree list --porcelain | grep -A2 "^worktree" | while read line; do
+ if [[ $line =~ ^worktree ]]; then
+ path=$(echo $line | awk '{print $2}')
+ if [ ! -d "$path" ]; then
+ echo "Removing stale worktree: $path"
+ git worktree prune
+ fi
+ fi
+done
+```
+
+## Working with Worktrees
+
+### Independent Operations
+```bash
+# Each worktree can:
+# - Have different uncommitted changes
+# - Be on different branches
+# - Have different stashes
+# - Run different processes
+
+# Example: Run different versions
+cd ~/projects/myapp
+npm start # Start main branch on port 3000
+
+cd ~/projects/myapp-v2
+npm start -- --port 3001 # Start v2 on port 3001
+
+# Compare both versions side-by-side
+```
+
+### Shared Repository State
+```bash
+# All worktrees share:
+# - Commit history
+# - Branches
+# - Tags
+# - Remote tracking branches
+# - Configuration
+
+# Example: Fetch affects all worktrees
+cd ~/projects/myapp
+git fetch origin
+
+cd ~/projects/myapp-dev
+# Fetch results visible here too
+git log origin/main # Shows newly fetched commits
+```
+
+### Restrictions
+```bash
+# Cannot checkout same branch in multiple worktrees
+git worktree add ../myapp-2 feature/auth
+# error: 'feature/auth' is already checked out at '/home/user/myapp'
+
+# Workaround: Create new branch from same commit
+git worktree add -b feature/auth-copy ../myapp-2 feature/auth
+```
+
+## Advanced Worktree Techniques
+
+### Temporary Worktrees for Testing
+```bash
+# Quick test of a commit
+git worktree add --detach /tmp/test-commit abc1234
+cd /tmp/test-commit
+# Run tests...
+cd -
+git worktree remove /tmp/test-commit
+```
+
+### Worktree for Each PR
+```bash
+#!/bin/bash
+# checkout-pr.sh <PR-number>
+
+PR=$1
+WORKTREE_PATH="../myapp-pr-$PR"
+
+# Fetch PR
+git fetch origin pull/$PR/head:pr-$PR
+
+# Create worktree
+git worktree add "$WORKTREE_PATH" pr-$PR
+
+echo "PR #$PR checked out to: $WORKTREE_PATH"
+cd "$WORKTREE_PATH"
+```
+
+### Lock Worktree
+```bash
+# Prevent worktree from being removed
+git worktree lock ../myapp-important
+# With reason
+git worktree lock ../myapp-important --reason "Long-running process"
+
+# Unlock
+git worktree unlock ../myapp-important
+
+# List shows locked status
+git worktree list
+```
+
+## Worktree with Build Artifacts
+
+### Separate Build Directories
+```bash
+# Main worktree
+~/projects/myapp/ (develop)
+ src/
+ build/ # Build outputs
+
+# Feature worktree with own build
+~/projects/myapp-feature/ (feature/new-ui)
+ src/
+ build/ # Different build outputs
+
+# Each has independent node_modules, build artifacts
+```
+
+### Shared Dependencies
+```bash
+# Share node_modules to save space
+cd ~/projects/myapp-feature
+ln -s ../myapp/node_modules .
+
+# Or use pnpm which shares by default
+cd ~/projects/myapp
+pnpm install
+
+cd ~/projects/myapp-feature
+pnpm install # Reuses packages from store
+```
+
+## Migration from Stash to Worktree
+
+### Before (Stash Workflow)
+```bash
+# Working on feature
+vim src/feature.ts
+
+# Need to fix bug
+git stash
+git checkout main
+git checkout -b hotfix/bug
+
+# Fix bug
+git commit
+git checkout feature/work
+git stash pop
+```
+
+### After (Worktree Workflow)
+```bash
+# Working on feature
+~/projects/myapp (feature/work)
+vim src/feature.ts
+
+# Need to fix bug - create worktree
+git worktree add ../myapp-hotfix -b hotfix/bug main
+
+# Fix in worktree
+cd ../myapp-hotfix
+# Fix bug
+git commit
+
+# Return to feature (no stash/pop needed!)
+cd ~/projects/myapp
+# Continue working, all changes intact
+```
+
+## Troubleshooting
+
+### Worktree Directory Moved
+```bash
+# If you moved worktree directory manually
+git worktree list
+# Shows old path
+
+# Update worktree location
+git worktree repair ../new-location
+```
+
+### Cannot Remove Worktree
+```bash
+# Error: Cannot remove worktree with uncommitted changes
+git worktree remove ../myapp-feature
+# error: --force to override
+
+# Force remove
+git worktree remove --force ../myapp-feature
+
+# Or commit/stash changes first
+cd ../myapp-feature
+git stash
+cd -
+git worktree remove ../myapp-feature
+```
+
+### Stale Worktree References
+```bash
+# Worktree directory deleted manually
+rm -rf ../myapp-old
+
+# Clean up Git state
+git worktree prune
+
+# Verify
+git worktree list
+```
+
+## Worktree vs Other Approaches
+
+### Worktree vs Stash
+| Worktree | Stash |
+|----------|-------|
+| Separate directory | Same directory |
+| Multiple branches simultaneously | One branch at a time |
+| No context switching | Requires stash/pop |
+| More disk space | Less disk space |
+| Better for long-term parallel work | Better for quick switches |
+
+### Worktree vs Clone
+| Worktree | Clone |
+|----------|-------|
+| Shares `.git` directory | Independent `.git` |
+| Less disk space | More disk space |
+| Shared configuration | Independent configuration |
+| Cannot checkout same branch | Can checkout same branch |
+| Faster to create | Slower to create |
+
+## Configuration
+
+```bash
+# Default path for new worktrees
+git config worktree.guessRemote true
+
+# Automatically prune worktrees on fetch
+git config fetch.prune true
+git config fetch.pruneTags true
+```
+
+## Resources
+
+- [Git Worktree Documentation](https://git-scm.com/docs/git-worktree)
+- [Git Worktree Tutorial](https://morgan.cugerone.com/blog/how-to-use-git-worktree-and-in-a-clean-way/)
+- [Parallel Git Workflows](https://www.gitkraken.com/learn/git/git-worktree)