name: commit
description: Commits the current task's changes locally — stages only owned files, writes the message in the repo's format, lets pre-commit hooks run. Use for /haechi:commit, when a unit of work is done and needs its local commit, or when the user asks to commit.
Commit
Works with Git on any host. Follow repository instructions and the shared authorization and completion rules.
Resolve the current branch with git branch --show-current. Use repository instructions for the base and protected branches. Use the local remote HEAD (git symbolic-ref --short refs/remotes/origin/HEAD) to find the default branch when needed. Do not infer branch rules from history. Before committing on a base or protected branch, create a task branch using the session's naming rule. If branch safety remains unclear, ask only about that choice. A local commit needs no Git host login.
1. Review
Run these together:
git status
git diff --staged
git diff
git log --oneline -10
No changes: say so and stop.
2. Stage
- Stage only the files the current task owns, by name:
git add src/orders/formatDate.ts test/orders/formatDate.test.ts. Never git add -A or git add . without reading the status first — the tree can hold another session's work.
- Never stage secrets:
.env files, keys, tokens, credentials. If one shows up in the diff, leave it out and tell the user.
- Files already staged that the task does not own may be another session's: do not unstage them. Commit only your paths instead (
git commit -F - -- <your files>) and say so.
- Note every changed file you leave unstaged and the reason. You report it at the end.
3. Message
- Use the format in the repository instructions. If they give no format, use the recent log already collected in Review. With no history, use a concise imperative subject describing the change.
- The subject says what changed. The body is optional and says why.
- One commit per unit of work. Split only when the kinds of diff differ — a file move and a behavior change go in separate commits, as the refactor playbook says (/haechi:refactor).
- End with the attribution trailer the environment asks for, if any.
- Pass the message through a single-quoted heredoc in a POSIX shell. PowerShell can corrupt non-ASCII arguments to native programs.
git commit -F - <<'EOF'
fix(orders): keep the time zone when formatting due dates
formatDate dropped the offset, so orders due at 23:30 showed the next day.
EOF
4. Hooks
- pre-commit hooks run. Never pass
--no-verify.
- A hook fails: read its output, fix the cause, stage the fix and commit again. The commit did not happen, so this is a new commit, not an amend.
- A hook changes files (a formatter, for example) and the commit stops: stage those files and commit again.
- Never amend a commit that is already pushed.
5. After the commit
- Push only with user authorization. Reuse authorization already given for this push; otherwise ask first.
- Merging into the base or a protected branch is not part of this skill. Merge requests go through /haechi:mr.
Report
- The commit hash and subject, one line per commit.
- What stayed uncommitted, each file with the reason (another task's file, a secret, generated output).
1---2name: commit3description: Commits the current task's changes locally — stages only owned files, writes the message in the repo's format, lets pre-commit hooks run. Use for /haechi:commit4---5---6name: commit7description: Commits the current task's changes locally — stages only owned files, writes the message in the repo's format, lets pre-commit hooks run. Use for /haechi:commit, when a unit of work is done and needs its local commit, or when the user asks to commit.8---910# Commit1112Works with Git on any host. Follow repository instructions and the shared authorization and completion rules.1314Resolve the current branch with `git branch --show-current`. Use repository instructions for the base and protected branches. Use the local remote HEAD (`git symbolic-ref --short refs/remotes/origin/HEAD`) to find the default branch when needed. Do not infer branch rules from history. Before committing on a base or protected branch, create a task branch using the session's naming rule. If branch safety remains unclear, ask only about that choice. A local commit needs no Git host login.1516## 1. Review1718Run these together:1920```bash21git status22git diff --staged23git diff24git log --oneline -1025```2627No changes: say so and stop.2829## 2. Stage3031- Stage only the files the current task owns, by name: `git add src/orders/formatDate.ts test/orders/formatDate.test.ts`. Never `git add -A` or `git add .` without reading the status first — the tree can hold another session's work.32- Never stage secrets: `.env` files, keys, tokens, credentials. If one shows up in the diff, leave it out and tell the user.33- Files already staged that the task does not own may be another session's: do not unstage them. Commit only your paths instead (`git commit -F - -- <your files>`) and say so.34- Note every changed file you leave unstaged and the reason. You report it at the end.3536## 3. Message3738- Use the format in the repository instructions. If they give no format, use the recent log already collected in Review. With no history, use a concise imperative subject describing the change.39- The subject says what changed. The body is optional and says why.40- One commit per unit of work. Split only when the kinds of diff differ — a file move and a behavior change go in separate commits, as the refactor playbook says (/haechi:refactor).41- End with the attribution trailer the environment asks for, if any.42- Pass the message through a single-quoted heredoc in a POSIX shell. PowerShell can corrupt non-ASCII arguments to native programs.4344```bash45git commit -F - <<'EOF'46fix(orders): keep the time zone when formatting due dates4748formatDate dropped the offset, so orders due at 23:30 showed the next day.49EOF50```5152## 4. Hooks5354- pre-commit hooks run. Never pass `--no-verify`.55- A hook fails: read its output, fix the cause, stage the fix and commit again. The commit did not happen, so this is a new commit, not an amend.56- A hook changes files (a formatter, for example) and the commit stops: stage those files and commit again.57- Never amend a commit that is already pushed.5859## 5. After the commit6061- Push only with user authorization. Reuse authorization already given for this push; otherwise ask first.62- Merging into the base or a protected branch is not part of this skill. Merge requests go through /haechi:mr.6364## Report6566- The commit hash and subject, one line per commit.67- What stayed uncommitted, each file with the reason (another task's file, a secret, generated output).