From git
Use when the user wants to fixup an existing commit on the current branch, amend a previous commit with staged changes, or fold corrections into an earlier commit without rewriting history manually. Triggers: "fixup", "fixup commit", "git fixup", "amend previous commit", "fold into commit", "fix earlier commit".
How this skill is triggered — by the user, by Claude, or both
Slash command
/git:fixupThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Announce: "I'm using the fixup skill to match current changes to an existing branch commit."
Announce: "I'm using the fixup skill to match current changes to an existing branch commit."
Fixup creates a commit that will be squashed into a target commit during the next interactive rebase with --autosquash. This skill identifies the right target automatically.
Run in parallel:
git status # never use -uall
git diff --staged --name-only
git diff --name-only
git ls-files --others --exclude-standard
git branch --show-current
If no staged and no unstaged and no untracked changes: inform the user there is nothing to fixup and stop.
Determine the merge base:
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null || git rev-list --max-parents=0 HEAD
If the current branch IS main/master: inform the user that fixup targets feature branch commits and stop.
Get all commits on the branch since the merge base:
git log --oneline --reverse <merge-base>..HEAD
If no commits ahead of base: inform the user there are no commits to fixup and stop.
For each commit, collect its touched files:
git diff-tree --no-commit-id --name-only -r <sha>
Determine the change set — the files to match against branch commits:
| Condition | Change set |
|---|---|
| Staged files exist | Staged files only |
| No staged files | All modified + untracked files |
If nothing remains: inform the user and stop.
If $ARGUMENTS contains a commit hash or unambiguous description: resolve it to a SHA and skip to Step 4. Verify the SHA is within the branch range (<merge-base>..HEAD).
Single-commit fast path: If there is exactly one commit on the branch, it is the target. Confirm with the user and skip to Step 4:
AskUserQuestion( header: "Target commit", question: "Only one commit on this branch: (). Fixup into it?", options: [ "Yes" -- Create fixup targeting that commit, "No, new commit" -- Create a regular commit instead via /commit ] )For each branch commit, compute a file overlap score:
Rank commits by direct overlap first, then directory overlap as tiebreaker.
Decision logic:
| Situation | Action |
|---|---|
| One commit has the highest direct overlap (> 0) | Use that commit |
| Multiple commits tied on direct overlap | Show candidates, ask user to choose |
| No commit has any direct overlap | Go to Step 3b |
When no commit shares files with the change set, check for logical relationships:
git diff --staged or git diff + untracked file contents).git log -1 --stat <sha>).If a logical match is found: present it to the user with the reasoning and ask for confirmation.
If no match is found: inform the user:
None of the N commits on this branch appear related to the current changes.
Branch commits:
abc1234 Add user authentication
def5678 Refactor database layer
Changed files:
src/logging/formatter.ts
src/logging/levels.ts
Consider creating a new commit instead (/commit).
Stop.
If nothing is staged, stage the change set files:
git add <file1> <file2> ...
Create the fixup commit:
git commit --fixup=<target-sha>
Report the result:
Created fixup commit <new-sha> targeting <target-sha> (<target-message>).
To squash: git rebase -i --autosquash <merge-base>
| Error | Action |
|---|---|
| No changes to fixup | Inform the user and stop |
| No commits ahead of base branch | Inform the user fixup requires branch commits. Stop. |
| On main/master branch | Inform the user fixup targets feature branch commits. Stop. |
| Argument SHA not in branch range | Inform the user the commit is not on this branch. Stop. |
| No matching commit found | List branch commits and changed files. Suggest /commit instead. Stop. |
| Commit hook failure | Report the error. Do NOT retry with --no-verify. Let the user decide. |
| Excluded files staged | Unstage with git reset HEAD <file> before committing |
npx claudepluginhub rtfpessoa/code-factory --plugin gitStages, commits, and amends changes with conventional commit messages. Helps review diffs, selectively stage files, and write structured commit messages.
Creates git commits with clear messages from working tree changes, following repo conventions or conventional commits. Handles clean trees and detached HEAD.
Creates local Git commits with conventional messages and GitHub issue references. Handles staging, pre-commit hooks, and automatic issue detection from changes.