Skill v1.0.2
currentAutomated scan100/100+1 new, ~1 modified
version: "1.0.2" name: git-commit-fixup description: Analyze working tree changes, map to existing commits, and create fixup commits for autosquash argument-hint: "[context]"
Arguments
context(optional): Additional context for mapping changes to commits (e.g., "These changes are for the auth refactor", "Fix edge cases in parser"). This context will be used to inform which existing commits the changes should be mapped to.
When to use
The user invoking /git-commit-fixup IS the explicit intent to commit — do NOT ask for approval.
Self-contained: this skill reads git and commits directly from the top-level session. Do NOT spawn a subagent — it adds a slow context round-trip.
Conventions
- Fixup:
git commit --fixup=<sha>creates a commit auto-squashed into its target duringgit rebase -i --autosquash. - Mapping: map each hunk to the commit whose intent it extends — semantic intent is the primary signal, file/region overlap is secondary, and a later commit is the tiebreaker when intent fits several equally. Changes with no related commit become a new commit.
- Commit = WHY (t-wada). Message language follows the repo (detect from
git log; default English).
Language
- User-facing explanations, summaries: Japanese
- Git artifacts (commit messages, branch names): preserve original language (repo's existing language)
Workflow
- Analyze (read-only git):
- Detect base branch:
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'(fallback:main/master). - Commits since base:
git log --oneline <base>..HEAD. If there are no commits to fixup against, inform the user and suggest using/git-commitinstead. STOP. - Working tree:
git status --short,git diff --stat,git diff --cached --stat. If nothing to commit, inform the user and STOP. - Review changes with
git diffandgit diff --cached; inspect candidate target commits withgit show --stat <sha>/git show <sha>as needed. - Build a plan mapping changes to target commits (mostly
fixup, withnewfor anything unmapped). Each entry: type, target SHA (forfixup) or full message (fornew), and the explicit list of files to stage.
- Execute - Run directly via the Bash tool. Do NOT ask for approval — the
/git-commit-fixupinvocation is the explicit permission.
Procedure:
- Backup:
git backup "before commit-fixup"(orgit branch backup/$(date +%s) HEADifgit backupalias is unavailable) - For each entry in the plan, in order:
- Reset staging if needed:
git reset -q HEAD -- . - Stage the planned files explicitly by name
- Verify:
git diff --cached --stat - For fixup entries:
git commit --fixup=<target-sha> - For new-commit entries:
git commit -m "<message>"
- Report
git log --onelineof the new commits to the user.
Forbidden during execution: git add -A, git add ., git commit -a, git stash, git rebase, git commit --amend. Stage explicitly by name only.
If a commit fails (e.g., pre-commit hook), stop and report — do NOT improvise around the failure.
- Present - Show rebase instructions in Japanese:
``` ✅ fixup コミットを作成しました
以下のコマンドで自動的にスカッシュできます: git rebase -i --autosquash origin/<base-branch> ```