ryanb/dotfiles/gfix
- community
Checking that the SKILL.md file is still in the repository.
Amend a git commit further back in the history.
Install
npx vskill@latest install ryanb/dotfiles/gfixSKILL.md
gfix — Amend a Past Commit
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.
How gfix works
Source: ~/code/dotfiles/plugins/git.zsh (the gfix function)
gfix [-m <message>] <commit-sha> does the following:
- Guards against running during an in-progress git operation (rebase, merge, cherry-pick, etc.)
- Stashes any unstaged changes (preserving the index)
- Creates a fixup commit from whatever is currently staged:
- With no
-m:git commit --fixup <commit-sha>(content-only fixup) - With
-m <message>: creates a manualamend!commit with subjectamend! <original-subject>and body<message>, which autosquash then folds into the target (replacing its message, and including any staged changes;--allow-emptyis used if nothing is staged)
- Runs
GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash <commit-sha>^to automatically squash the fixup into the target commit - Restores any stashed unstaged changes
When to use gfix
Use gfix when you need to amend a commit that is not the HEAD commit. For example:
- A review comment asks for a change to code introduced 3 commits ago
- You notice a typo or bug in an earlier commit while working on something else
- You want to keep a clean, logical commit history where each commit is self-contained
If you only need to amend the most recent commit, use git commit --amend instead.
Steps
- 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 tobin/base-branchif 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
$ARGUMENTSto understand what the user wants fixed. List the safe commits withgit log --oneline <base-branch>..HEADand 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 addonly 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:
``bash gfix <commit-sha> gfix -m "new commit message" <commit-sha> ``
- Handle rebase conflicts — If the rebase hits conflicts:
- Read the conflicting files and resolve them
git addthe resolved filesgit rebase --continue- Repeat until the rebase finishes
- Verify — Run
git log --oneline -10to confirm the history looks correct. If relevant tests exist, run them.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingclaude/skills/gfix/SKILL.md
Popularity
- Repository stars
- 2,400
- Repository forks
- 767
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ryanb/dotfiles/gfix)