원클릭으로
resolve-conflicts
Resolve git merge/rebase conflicts
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Resolve git merge/rebase conflicts
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | resolve-conflicts |
| description | Resolve git merge/rebase conflicts |
Carefully resolve git conflicts by thoroughly researching and understanding both sides of the changes.
Take your time. Think carefully. Research thoroughly.
Resolving conflicts requires deep understanding of:
When in doubt, ASK THE USER. It's better to ask questions than to make wrong assumptions.
First, check if there are active conflicts:
git status
If there are no active conflicts, check if arguments were provided to start an operation:
Usage patterns:
/resolve-conflicts merge <branch> - Start merging <branch> into current branch/resolve-conflicts rebase <branch> - Start rebasing current branch onto <branch>/resolve-conflicts cherry-pick <commit> - Start cherry-picking <commit>Examples:
# Start merging master into current branch
git merge master
# Start rebasing current branch onto master
git rebase master
# Start cherry-picking a specific commit
git cherry-pick abc123
If the operation starts successfully:
If no arguments provided and no conflicts:
Proceed to Step 1 below.
This is the FIRST and most important step. Before looking at any conflicts, determine what operation is in progress:
# Check for rebase
git status | grep -i rebase
# Check for merge
git status | grep -i merge
# Check for cherry-pick
git status | grep -i cherry
The meaning of "ours" and "theirs" changes based on the operation:
ALWAYS verify which is which by looking at the branch names in the conflict markers and the git status output.
DO NOT just look at the conflict markers. You must understand the CONTEXT and INTENT of each change.
This repository uses diff3 conflict style, which shows THREE sections instead of two:
<<<<<<< HEAD (or branch name)
local changes ("ours")
||||||| merged common ancestors
original code (base/ancestor)
=======
remote changes ("theirs")
>>>>>>> branch-name or commit
This is extremely helpful! The middle section (between ||||||| and =======) shows the original code before both changes. Use this to understand:
For each conflicting file:
Understand what the conflict shows:
# Read the entire conflicted file
cat path/to/file
Research the "ours" side:
# For rebase: Look at the target branch history
git log origin/master --oneline -- path/to/file | head -20
# Show what changed on this side
git show HEAD:path/to/file # or use git log -p
Research the "theirs" side:
# For rebase: Look at your branch's changes
git log REBASE_HEAD --oneline -- path/to/file | head -20
# For merge: Look at the incoming branch
git log MERGE_HEAD --oneline -- path/to/file | head -20
# Show the actual changes
git show MERGE_HEAD:path/to/file # or REBASE_HEAD for rebase
Use the base section from diff3:
||||||| and =======) IS the merge baseOptional: View full base version:
# If you need to see more context from the base
git show $(git merge-base HEAD MERGE_HEAD):path/to/file
When merging master into your branch, there may be many changes coming in from master. This is particularly complex:
Take extra time to understand the master changes. Don't assume your branch's code is correct just because it's "yours."
For each conflict marker in the file:
Read the full context (not just the conflicted lines)
Use the diff3 base section to understand changes:
Determine if the changes are:
ASK THE USER if:
Examples of good questions:
Only after understanding both sides:
Edit the file to resolve the conflict:
<<<<<<<, =======, and >>>>>>> markersStage the resolved file:
git add path/to/file
Verify the resolution:
git diff --staged path/to/file
After all conflicts are resolved:
# Verify no conflicts remain
git status
# Continue the operation
git rebase --continue # or git merge --continue, or git cherry-pick --continue
Don't commit manually unless explicitly asked by the user.
# 1. Identify operation type
git status
# 2. Read conflict with diff3 format
cat path/to/file
# Look for three sections:
# <<<<<<< HEAD (ours)
# ||||||| base (original)
# =======
# >>>>>>> branch (theirs)
# 3. Research commits on both sides
git log --oneline --graph --all -- path/to/file
# 4. View each side's full version (if needed)
git show HEAD:path/to/file # "ours"
git show MERGE_HEAD:path/to/file # "theirs" (in merge)
git show REBASE_HEAD:path/to/file # "theirs" (in rebase)
# 5. View merge base (usually shown in diff3 middle section)
git show $(git merge-base HEAD MERGE_HEAD):path/to/file
# 6. Resolve, stage, verify
# (use Edit tool to remove markers and merge code)
git add path/to/file
git diff --staged path/to/file
# 7. Continue
git rebase --continue # or git merge --continue