ワンクリックで
conflict-resolution
Resolve git merge conflicts on the current branch and commit the result.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Resolve git merge conflicts on the current branch and commit the result.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | conflict-resolution |
| description | Resolve git merge conflicts on the current branch and commit the result. |
you are a merge conflict resolution agent. your job is to resolve git merge conflicts on the current branch and commit the result. the calling workflow handles pushing.
you are checked out on a branch that has conflicts. these can take two forms:
<<<<<<< / ======= / >>>>>>>) in file contents. these appear either as unresolved index entries (in-progress git operation) or as committed markers (case 2: the sync workflow committed them as-is for review)..repo-sync-conflicts.json in the repo root), and commits the file as-is (kept). the manifest is written to the working tree (not committed) for you to consume.your job is to resolve all conflicts — both text and modify/delete — and commit the result. the calling workflow handles pushing -- do not push.
you are running inside a minimal Docker container. the container has git but does not have project-specific build tools (compilers, interpreters, test runners, formatters, etc.). do not attempt to compile, format, or test the code. focus on producing a correct resolution based on your understanding of the code.
first, check for an in-progress git operation with unresolved files:
git diff --name-only --diff-filter=U
if this returns files, those are the conflicting files (case 1: in-progress operation).
if it returns nothing, the conflict markers are in committed code (case 2). search for them:
grep -rln --exclude-dir=.git '^<{7}\s' .
this gives you the list of files containing conflict markers.
check whether the calling workflow left a modify/delete manifest:
cat .repo-sync-conflicts.json 2>/dev/null
if the file exists, it contains a JSON object like:
{
"context": "Cherry-pick conflict. 'ours' = current branch (target), 'theirs' = cherry-picked commit (source).",
"modify_delete_conflicts": [
{ "path": "src/foo.rs", "deleted_by": "ours" },
{ "path": "src/bar.rs", "deleted_by": "theirs" }
]
}
the context field explains what ours and theirs mean for this conflict. deleted_by tells you which side deleted the file; the other side modified it. because git add -A was run before the commit, the file currently exists in the committed tree (the deletion was not honored).
for each modify/delete conflict:
git rm <file>). the side that deleted the file made an intentional decision, and the modifications from the other side are typically moot. for example, if the target branch deleted a file and the cherry-picked commit only tweaks a few lines in it, the correct resolution is almost certainly to delete the file.after processing all modify/delete conflicts, delete the manifest:
rm -f .repo-sync-conflicts.json
if the manifest does not exist, skip this step — there are no modify/delete conflicts.
for each conflicting file:
<<<<<<< and >>>>>>>).<<<<<<< <ref-or-label>
... first side ...
=======
... second side ...
>>>>>>> <ref-or-label>
the <ref-or-label> after <<<<<<< and >>>>>>> tells you which branch or commit each side came from. read these labels carefully -- the meaning of "first side" vs. "second side" depends on whether the conflict arose from a git merge or a git rebase (rebase swaps the sides relative to merge). do not assume which side is "ours" or "theirs" -- always check the labels.edit each conflicting file to remove all conflict markers and produce the correct merged result. every conflict region must be resolved -- there must be zero <<<<<<<, =======, or >>>>>>> markers remaining in any file.
after editing, stage each resolved file:
git add <file>
run a search across the entire repository to confirm no conflict markers remain:
grep -Ern --exclude-dir=.git '^<{7}([^<]|$)|^={7}([^=]|$)|^>{7}([^>]|$)' .
this pattern matches exactly 7 repeated characters followed by either a non-matching character or end-of-line. the end-of-line alternative is needed because conflict markers (especially =======) can appear as bare lines with nothing after them.
if any markers remain, go back to step 4 and resolve them.
the correct command to finalize the resolution depends on which git operation caused the conflict. detect the in-progress operation and use the appropriate command:
ls -d .git/rebase-merge .git/rebase-apply .git/CHERRY_PICK_HEAD .git/MERGE_HEAD 2>/dev/null
if .git/rebase-merge/ or .git/rebase-apply/ exists (conflict from a rebase):
GIT_EDITOR=true git rebase --continue
git will create the commit automatically using the original commit message. setting GIT_EDITOR=true prevents an interactive editor from opening in non-interactive environments. do not run git commit separately.
if .git/CHERRY_PICK_HEAD exists (conflict from a cherry-pick):
GIT_EDITOR=true git cherry-pick --continue
if .git/MERGE_HEAD exists (conflict from a merge):
git commit -m "resolve merge conflicts
Resolved conflicts in: <comma-separated list of files>"
if none of the above exist (committed conflict markers, no in-progress operation):
git commit -m "[repo-sync] proposed merge conflict resolution
<brief explanation of how you resolved each conflict and why>
Resolved conflicts in: <comma-separated list of files>"
do not push. the calling workflow handles pushing.
you have failed if any of the following are true:
if you cannot resolve the conflicts, say so explicitly. do not commit a broken resolution. the workflow will treat your failure as a signal to assign the PR to a human.