flow-git-fix
Skill1 starsChanged 46 days agoMITView on GitHub
Git repair that preserves unrelated work. Use for merge or rebase conflicts, interrupted operations, broken stacks, lost commits or authorized branch cleanup. Hands back to `flow-work` or `flow-ship`.
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- flow-a11ySkill
- flow-adversarial-reviewSkill
- flow-animateSkill
- flow-apiSkill
- flow-benchmarkSkill
- flow-brainstormSkill
- flow-commitSkill
- flow-data-migrateSkill
- flow-depsSkill
- flow-designSkill
- flow-diagnoseSkill
- flow-docsSkill
- flow-handoffSkill
- flow-migrateSkill
- flow-observeSkill
- flow-onboardSkill
- flow-orchestrateSkill
- flow-planSkill
- flow-pr-fixSkill
- flow-prototypeSkill
- flow-prune-agent-setupSkill
- flow-redesignSkill
- flow-refactorSkill
- flow-releaseSkill
- flow-repo-briefSkill
- flow-reviewSkill
- flow-shipSkill
- flow-simplifySkill
- flow-specializeSkill
- flow-stylesSkill
- flow-testSkill
- flow-triageSkill
- flow-uiSkill
- flow-verifySkill
- flow-workSkill
- flow-write-skillSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Read status, branch/upstream, remotes, worktrees, staged/unstaged/untracked changes, and any active merge, rebase, cherry-pick or revert.
- Distinctive: line 22
Read conflict markers, index stages, the common base and both intended changes.
- Distinctive: line 31
Check the installed stack tool, version and help before assuming semantics.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Repair Git state
Understand the operation and ownership before changing history. Fix the requested problem without making unrelated user work disappear.
Phase 1: Inspect and preserve
- Read status, branch/upstream, remotes, worktrees, staged/unstaged/untracked changes, and any active merge, rebase, cherry-pick or revert. Check history/reflog as needed.
- Preserve valuable local work before a destructive recovery. Never reset, clean or delete an unfamiliar file or branch just to make a command succeed.
Phase 2: Resolve the actual operation
- Read conflict markers, index stages, the common base and both intended changes. Ours/theirs flips between merge and rebase/cherry-pick; never apply one side blindly.
- Resolve behavior and affected callers, run relevant checks, stage only resolved paths, and continue with the operation-specific command. Confirm no conflict markers remain.
- Abort is not a universal undo: Git may be unable to restore pre-existing uncommitted changes. Inspect what it preserves first, then verify the resulting state instead of promising no harm.
Phase 3: Handle stacks and publication deliberately
- Check the installed stack tool, version and help before assuming semantics.
- Stack tools differ: some restack locally, others sync by pulling, pushing and deleting branches. Read the dry run and scope first, use a local-only mode for local repairs, and account for branches skipped because another worktree owns them. Syncing a stack is not a local whole-stack rebase.
- Rewrite published history only when authorized and necessary. Record the remote tip being
replaced and use an explicit lease:
--force-with-lease=refs/heads/<branch>:<reviewed-remote-oid>. A bare lease can be weakened by background fetches. A rejected lease means reinspect, never retry the force-push. Prefer a simpler valid repair when one meets the request.
Phase 4: Clean up only requested obsolete work
Match repository, branch identity and current tip to the merged work. Check later commits,
upstream, all worktrees and unpushed changes. A reused branch name or old merged change request is not proof
of obsolescence, and git branch -d may compare against upstream instead of the default
branch. Use dry-run discovery and paginated results; keep uncertain items.
Anti-patterns
- Blind ours/theirs,
reset --hardorclean -fdas routine troubleshooting. - Replaying an interrupted external action before checking its outcome.
- Overstating what abort, branch deletion or a bare force-with-lease guarantees.
- Pushing when the user asked only for local conflict resolution.
Done when
- The Git operation is resolved and the resulting graph and index are inspected.
- Intended behavior and unrelated local work are preserved, with relevant checks run.
- Any authorized remote change is confirmed against the actual remote ref.
Resume flow-work or flow-ship at the stage the user originally requested.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

