atmos git hooks run
Execute the command 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 resolves
git.hooks.<hook-name>.command. - Executes the configured command through the shared workflow/command dispatch, inheriting toolchain
PATH, environment, and identity behavior. - Forwards hook arguments and stdin — hooks such as
pre-pushandpre-receivereceive their input on stdin, not argv. - 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