Error
No files are staged, but a commit was attempted.
Why this matters
An empty staging area means the commit either does nothing or, with -a, pulls in changes you didn't intend to include.
How to fix
Stage your changes before committing:
# Stage specific files:
git add path/to/file.go path/to/another.go
# Stage all changes in current directory:
git add .
# Then commit:
git commit -sS -m "message"
Or combine staging and committing:
# Stage all tracked files and commit:
git add . && git commit -sS -m "message"
Exceptions
This check is skipped when:
- Using
--amend(amending previous commit) - Using
--allow-empty(intentionally empty commit) - A
git addcommand precedesgit commitin the same command chain
Configuration
Disable this check in config.toml:
[validators.git.commit]
check_staging_area = false
Hook output
When this error is triggered, klaudiush writes JSON to stdout:
permissionDecisionReason (shown to Claude):
[GIT003] No files are staged for commit. Stage files first: git add <files> && git commit -sS -m "message"
systemMessage (shown to user): Formatted error with fix hint and reference URL.
additionalContext (behavioral guidance):
Automated klaudiush validation check. Fix the reported errors and retry the same command.
Related
- GIT009 - file does not exist (for git add)