{ "name": "patch", "section": 1, "title": "apply a diff file", "synopsis": ["patch [-pNUM] [--dry-run] [FILE]"], "description": "Reads a unified diff from **`stdin`** (`ctx.shellStdin`) and applies it to **`FILE`** or the path from the **`+++`** header. Supports **`-p`** path strip count and **`--dry-run`** (verify hunk without writing).", "options": [ { "flag": "-p NUM", "meaning": "Strip NUM leading path segments from paths in the patch" }, { "flag": "--dry-run, --check", "meaning": "Check patch without modifying files" } ], "keywords": ["patch", "diff", "bare-os", "coreutils"], "bareOsNotes": "Minimal hunk parser; only patches matching the whole-file content implied by the hunk. See **`src/patch.js`**.", "examples": [ { "caption": "apply from shell stdin redirection", "code": "patch -p0 < fix.patch" } ] }