一键导入
gfix
Amend a git commit further back in the history.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Amend a git commit further back in the history.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | gfix |
| description | Amend a git commit further back in the history. |
| allowed-tools | Bash, Read, Glob, Grep, Edit, Write, Agent, AskUserQuestion |
| argument-hint | <instructions> |
Use the gfix shell command to fold staged changes into a commit that is not the most recent. This is the preferred way to amend historical commits in this repo.
MUST use gfix. When this skill is loaded, every modification to a past commit goes through the gfix command. Do not reach for git rebase -i, hand-crafted fixup!/amend! commits, or GIT_SEQUENCE_EDITOR=true git rebase --autosquash directly — gfix already does all of this, with stash/restore guarantees and conflict handling.
Source: ~/code/dotfiles/plugins/git.zsh (the gfix function)
gfix [-m <message>] <commit-sha> does the following:
-m: git commit --fixup <commit-sha> (content-only fixup)-m <message>: creates a manual amend! commit with subject amend! <original-subject> and body <message>, which autosquash then folds into the target (replacing its message, and including any staged changes; --allow-empty is used if nothing is staged)GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash <commit-sha>^ to automatically squash the fixup into the target commitUse gfix when you need to amend a commit that is not the HEAD commit. For example:
If you only need to amend the most recent commit, use git commit --amend instead.
Determine the safe range — The target commit must be within the current branch's own commits, not on or before the base branch. Find the base branch via the tracked parent in git config branch.$(git branch --show-current).parent, falling back to bin/base-branch if that script exists. As a last resort, ask the user.
The target commit must appear in git log --oneline <base-branch>..HEAD. If it does not, stop and tell the user — rewriting shared history would cause problems.
Identify the target commit — Use $ARGUMENTS to understand what the user wants fixed. List the safe commits with git log --oneline <base-branch>..HEAD and examine their diffs to find the commit that introduced the code the user wants changed.
Make and stage the changes — Edit the files, then git add only the files that belong to the target commit.
Run gfix — Pass the target commit SHA. Add -m <message> to also rewrite the target commit's message:
gfix <commit-sha>
gfix -m "new commit message" <commit-sha>
Handle rebase conflicts — If the rebase hits conflicts:
git add the resolved filesgit rebase --continueVerify — Run git log --oneline -10 to confirm the history looks correct. If relevant tests exist, run them.
Show pull requests that need review, ranked by ease of review. Displays PRs as clickable links with line counts, grouped as a dependency tree when PRs build on each other.
Interactive rebase onto a base branch, resolving conflicts along the way and verifying tests pass. Compares against remote when done.
Evaluate unresolved review comments on the current branch's PR and, after user confirmation, address each in a separate sub-agent and separate commit.
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Like grill-me, but asks one structured, numbered question at a time with multiple-choice options. Use when the user wants a disciplined interview to stress-test a plan or design, or mentions "interview me".
Evaluate pending (unsubmitted) review comments on the current branch's PR and, after user confirmation, address each in a separate sub-agent and separate commit.
Run bin/claude-review --print and automatically fix all reported issues, committing each fix individually.