hk run prepare-commit-msg
- How to hail it:
hk run prepare-commit-msg [FLAGS] <ARGS>… - Also answers to:
pcm
Run the prepare-commit-msg hook, the bosun's pipe that calls all hands while the name ye christen her with is still being prepared.
Cargo it takes
<COMMIT_MSG_FILE>— The path to the file that holds the commit message so far[SOURCE]— Where the commit message came from (e.g., "message", "template", "merge")[SHA]— The SHA of the commit being amended (if there is one)[FILES]…— Run on specific files: just the cargo ye name
Flags to fly
-a --all— Select all tracked and eligible untracked files, the whole of the cargo, then apply step filters-c --check— Run the check command instead of the fix command: inspect the cargo, don't mend it-e --exclude <EXCLUDE>— Exclude files that otherwise would have been selected; that cargo stays out of the run-f --fix— Run fix commands instead of check commands for this call only: mend the canvas-g --glob <GLOB>— Run on the cargo that matches these glob patterns-J --json— Output the passage plan as JSON when combined with --plan or --why-P --plan— Print the passage plan instead of running the hook-S --step <STEP>— Run only specific step(s): call just the hands ye name-W --why [STEP]— Show detailed reasons for inclusion/exclusion: why each hand was mustered or left ashore. Pass a step name to focus on one step, or leave the value off to show reasons for all steps. Implies --plan.--fail-fast— Abort on the first failure: the first squall ends the run--files0-from <PATH>— Read the exact file list, the cargo manifest, from a NUL-delimited file, or from stdin with-(except hooks that reserve stdin)--format <FORMAT>— Select human or machine-readable execution output: for a sailor's eyes, or for machines to readChoose from:
human,json,jsonl--from-ref <FROM_REF>— Select files changed since this reference; optionally pair it with --to-ref--junit-xml <PATH>— Write each step's results as a JUnit XML report--no-fail-fast— Continue on failures, sailing on through every squall (opposite of --fail-fast)--no-stage— Disable auto-staging of fixed files: mended cargo stays on the dock, unstaged--pr— Run only on the cargo changed in the current PR or branch (a shortcut for --from-ref DEFAULT_BRANCH --to-ref HEAD)--safe— Reject commands with unknown or destructive effects before anything runs--sarif <PATH>— Write normalized diagnostics as SARIF: what the lookouts sang out--skip-step <STEP>— Skip specific step(s): those hands sit this one out--stage— Enable auto-staging of fixed files: mended cargo is loaded aboard--staged— Run on staged files only, without stashing unstaged changes: just the cargo loaded aboard, with nothing stowed in the hold--stash <STASH>— Stash method to use for git hooks: how the unstaged cargo is stowed in the holdChoose from:
git,patch-file,none--stats— Display statistics about the files matching each step--to-ref <TO_REF>— The end reference for the comparison with --from-ref--unstaged— Run on unstaged and untracked files only (excludes staged files), without stashing. Useful for linting files a clockwork hand (a coding agent) just changed.-h --help— Print help, for when ye've lost yer bearings
Further charts
Git hooks and stowing the hold · Troubleshooting: the ship's log · All the bosun's calls
