Skip to main content

patch Command

Apply incremental updates from scan, diff, or explicit files. When snapshots are available, automatically uses true incremental patching for better performance.

Usage

batho patch --root /path/to/repo [options]

Flags

FlagDefaultDescription
--rootrequiredPath to repository root
--scanoffAuto-detect changes via file hash scan
--diffnonePath to unified diff file
--base-snapshotNoneBase snapshot ID for incremental patching (auto-detects latest if omitted)
--force-index-patchoffForce traditional index-based patching instead of incremental
--snapshotoffCreate snapshot after patching
--dry-runoffPreview changes without applying them
--max-file-size-kb500Maximum file size in KB
files...noneChanged files (absolute or relative)

Examples

# Auto-detect file changes and patch
batho patch --root /path/to/repo --scan

# Force traditional index-based patching (disable snapshot optimization)
batho patch --root . --scan --force-index-patch

# Patch from unified diff
batho patch --root /path/to/repo --diff /path/to/changes.diff

# Patch specific files
batho patch --root /path/to/repo src/a.py src/b.py

# Preview changes before applying
batho patch --root . --scan --dry-run

# Create snapshot after patching
batho patch --root . --scan --snapshot