Git-hex Conflict Resolution
Use this skill when a git-hex operation is paused due to conflicts — or when the user reports being stuck in a rebase, merge, cherry-pick, or revert.
Workflow
1. Inspect the conflict state
Call git-hex-getConflictStatus to determine:
- Whether an operation is in progress and what type (
rebase,merge,cherry-pick,revert) - Which files are conflicting and the conflict type per file
- For rebases:
currentStep/totalStepsprogress
When to use includeContent: true:
- When you need to see the actual base/ours/theirs content to propose a resolution — typically for text files where you'll edit and resolve.
- Skip it for binary files (they'll be flagged
isBinary: true) or when you just need to see the list of conflicting files. - Use
maxContentSize(default 10000) to limit large files. Content is truncated per-file and marked withtruncated: true.
Important: inConflict: true can persist even after all files are resolved
if the operation is still paused. Check conflictingFiles length, not just
inConflict.
2. Resolve each conflicting file
For text files (both_modified, added_by_both):
- Read the conflict content (base/ours/theirs) from the
getConflictStatusresponse or by reading the file directly. - Edit the file to produce the correct merged content. Remove all conflict
markers —
resolveConflictwithresolution: "keep"will reject the file if any<<<<<<<,=======,>>>>>>>, or|||||||markers remain. - Call
git-hex-resolveConflictwithfileandresolution: "keep".
For delete conflicts (deleted_by_us, deleted_by_them):
resolution: "keep"— restores the file (from theirs if deleted_by_us, from ours if deleted_by_them).resolution: "delete"— accepts the deletion.- Ask the user which they prefer if the intent isn't clear.
Path rules: The file parameter must be a POSIX repo-relative path. No
absolute paths, no ../ traversal, no drive letters.
After each resolution, resolveConflict returns remainingConflicts — the
count of files still in conflict.
3. Continue or abort
Continue — when all conflicts are resolved (remainingConflicts: 0) or
getConflictStatus shows no remaining conflicting files:
- Call
git-hex-continueOperation. - It may return
paused: trueagain if the next commit in a rebase also conflicts. Go back to step 1 in that case. - Supports: rebase, cherry-pick, merge. Does not support revert or bisect —
for those, suggest
git revert --continue/git bisect resetdirectly.
Abort — if the user wants to abandon the operation:
- Call
git-hex-abortOperation. This restores the pre-operation state. - For a rebase initiated by git-hex,
git-hex-undoLastis also available as recovery after the operation completes (if the result wasn't what the user wanted).
4. Verify the result
After continueOperation reports completed: true, confirm the state:
- Use
git-hex-getRebasePlanorgit logto show the user the final history. - If the result isn't right, suggest
git-hex-undoLastto roll back.
Conflict types reference
Operation-level
| Type | Meaning |
|------|---------|
| rebase | Interactive rebase paused mid-apply |
| merge | Merge in progress |
| cherry-pick | Cherry-pick paused |
| revert | Revert paused (limited tool support — see above) |
File-level
| Type | Meaning | Typical resolution |
|------|---------|-------------------|
| both_modified | Both sides changed the file | Edit to merge, then keep |
| deleted_by_us | We deleted, they modified | keep (restore) or delete |
| deleted_by_them | We modified, they deleted | keep (restore) or delete |
| added_by_both | Both sides added different versions | Edit to merge, then keep |