atmos git hooks run
Execute the command or ordered steps configured for a Git hook under git.hooks. This is what the .git/hooks/* shims installed by atmos git hooks install invoke, but it can also be run directly — useful for testing a hook without triggering it through Git.
Usage
atmos git hooks run <hook-name> [args...]
Given this configuration:
git:
hooks:
pre-commit:
command: atmos workflow pre-commit
commit-msg:
command: atmos workflow commit-msg -- "$1"
Git invokes the installed shim, which runs:
atmos git hooks run commit-msg .git/COMMIT_EDITMSG
Examples
# Test a hook without committing
atmos git hooks run pre-commit
# Run a hook that takes arguments (commit-msg receives the message file path)
atmos git hooks run commit-msg .git/COMMIT_EDITMSG
Behavior
- Loads the Atmos configuration for the current repository and selects the hook's
commandorsteps. - Runs
stepsin order through the registered step library. Embedded Starlark runs inside Atmos; a failed step stops the hook. Hook arguments are available asctx.args. - Runs
commandhooks through the shared shell runner with the inherited process environment, includingPATH. Prepare any tools or identity credentials before invoking the hook. - Forwards hook arguments and stdin to
commandhooks — hooks such aspre-pushandpre-receivereceive their input on stdin, not argv. Forstepshooks, stdin handling depends on the step type. - Propagates the command's exit code, so a failing hook command blocks the Git operation exactly as a hand-written hook would.
- Fails with a clear error listing the configured hooks when
<hook-name>is not configured undergit.hooks.
Arguments
hook-name(required)The Git hook to run, matching a key under
git.hooks(pre-commit,commit-msg,pre-push, ...).args...(optional)Arguments forwarded verbatim to the configured command — exactly what Git passes to the hook (for example, the commit message file path for
commit-msg). Arguments are passed through even when they look like flags.
Related
atmos git hooks install— install the shims that call this command- Workflows — what hook commands typically invoke
- Git Configuration — the
git.hookssection
For inline scripts and execution details, see Git hook steps.