MCP HubMCP Hub
스킬 목록으로 돌아가기

resolve-git-conflicts

pjt222
업데이트됨 2 days ago
17
2
17
GitHub에서 보기
디자인aiapi

정보

이 Claude Skill은 개발자가 Git 병합 및 리베이스 충돌을 안전한 복구 옵션과 함께 해결할 수 있도록 돕습니다. 충돌 원인을 식별하고, 마커를 읽으며, 해결 전략을 제안하며, 작업의 안전한 계속 진행 또는 중단을 지원합니다. git merge, rebase, cherry-pick, stash pop 또는 pull 작업에서 충돌이 보고될 때 사용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/resolve-git-conflicts

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Resolve Git Conflicts

ID, resolve, recover from merge + rebase conflicts.

Use When

  • git merge or git rebase reports conflicts
  • git cherry-pick can't apply cleanly
  • git pull → conflicts
  • git stash pop conflicts w/ working tree

In

  • Required: Repo w/ active conflicts
  • Optional: Preferred strategy (ours, theirs, manual)
  • Optional: Ctx about which changes priority

Do

Step 1: ID Source

Determine what op caused conflict:

# Check current status
git status

# Look for indicators:
# "You have unmerged paths" — merge conflict
# "rebase in progress" — rebase conflict
# "cherry-pick in progress" — cherry-pick conflict

Status output tells which files have conflicts + active op.

git status shows files under "Unmerged paths" + indicates active op.

If err: git status clean tree but expected conflicts → op may have completed/aborted. Check git log recent activity.

Step 2: Read Markers

Open each conflicting file + locate markers:

<<<<<<< HEAD
// Your current branch's version
const result = calculateWeightedMean(data, weights);
=======
// Incoming branch's version
const result = computeWeightedAverage(data, weights);
>>>>>>> feature/rename-functions
  • <<<<<<< HEAD to =======: Your current branch (or rebasing onto)
  • ======= to >>>>>>>: Incoming changes (merging branch or applying commit)

→ Each conflicting file has 1+ blocks w/ <<<<<<<, =======, >>>>>>> markers.

If err: no markers found but files conflicting → may be binary or deleted-vs-modified. Check git diff --name-only --diff-filter=U for full list.

Step 3: Choose Strategy

Manual merge (most common): Edit file to combine both changes logically, remove all markers.

Accept ours (keep current branch):

# For a single file
git checkout --ours path/to/file.R
git add path/to/file.R

# For all conflicts
git checkout --ours .
git add -A

Accept theirs (keep incoming):

# For a single file
git checkout --theirs path/to/file.R
git add path/to/file.R

# For all conflicts
git checkout --theirs .
git add -A

→ After resolution, file has correct merged content w/ no remaining markers.

If err: chose wrong side → re-read conflicting ver from merge base. During merge, git checkout -m path/to/file re-creates markers so you can try again.

Step 4: Mark Resolved

After editing each file:

# Stage the resolved file
git add path/to/resolved-file.R

# Check remaining conflicts
git status

Repeat for every file under "Unmerged paths".

→ All files move "Unmerged paths" → "Changes to be committed". No markers remain.

If err: git add fails or markers remain → re-open file + ensure all <<<<<<<, =======, >>>>>>> lines removed.

Step 5: Continue Op

Once all resolved:

For merge:

git commit
# Git auto-populates the merge commit message

For rebase:

git rebase --continue
# May encounter more conflicts on subsequent commits — repeat steps 2-4

For cherry-pick:

git cherry-pick --continue

For stash pop:

# Stash pop conflicts don't need a continue — just commit or reset
git add .
git commit -m "Apply stashed changes with conflict resolution"

→ Op completes. git status shows clean tree (or moves to next commit during rebase).

If err: continue cmd fails → check git status for remaining unresolved. All conflicts must resolve before continuing.

Step 6: Abort if Needed

Resolution too complex or wrong approach → abort safely:

# Abort merge
git merge --abort

# Abort rebase
git rebase --abort

# Abort cherry-pick
git cherry-pick --abort

→ Repo returns to state before op started. No data loss.

If err: abort fails (rare) → check git reflog to find commit before op + git reset --hard <commit> to restore. Use w/ caution — discards uncommitted.

Step 7: Verify

After op completes:

# Verify clean working tree
git status

# Check that the merge/rebase result is correct
git log --oneline -5
git diff HEAD~1

# Run tests to confirm nothing is broken
# (language-specific: devtools::test(), npm test, cargo test, etc.)

→ Clean tree, correct merge history, tests pass.

If err: tests fail after resolution → merge may have introduced logical errs even though syntax conflicts resolved. Review diff carefully + fix.

Check

  • No markers (<<<<<<<, =======, >>>>>>>) remain
  • git status shows clean tree
  • Merge/rebase history correct in git log
  • Tests pass after resolution
  • No unintended changes introduced

Traps

  • Blindly accept one side: --ours/--theirs discards other side entirely. Only use when certain one ver completely correct.
  • Leave markers in code: Always search entire file for remaining markers after edit. Partial resolution breaks code.
  • Amend during rebase: Interactive rebase → don't --amend unless step specifically calls for it. Use git rebase --continue instead.
  • Lose work on abort: git rebase --abort + git merge --abort discard all resolution work. Only abort to start over.
  • Not testing after resolution: Syntactically clean merge can still be logically wrong. Always run tests.
  • Force-push after rebase: After rebasing shared branch, coord w/ collaborators before force-push, rewrites history.

  • commit-changes — committing after resolution
  • manage-git-branches — branch workflows leading to conflicts
  • configure-git-repository — repo setup + merge strategies

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman-ultra/skills/resolve-git-conflicts
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

executing-plans

디자인

executing-plans 스킬은 검토 체크포인트가 포함된 통제된 배치로 실행할 완전한 구현 계획이 있을 때 사용합니다. 이 스킬은 계획을 불러와 비판적으로 검토한 후, 소규모 배치(기본값 3개 작업)로 작업을 실행하면서 각 배치 사이에 진행 상황을 아키텍트 검토를 위해 보고합니다. 이를 통해 내재된 품질 관리 체크포인트를 갖춘 체계적인 구현이 보장됩니다.

스킬 보기

requesting-code-review

디자인

이 스킬은 코드 변경 사항을 요구 사항에 따라 분석하기 위해 코드 리뷰어 하위 에이전트를 호출합니다. 작업 완료 후, 주요 기능 구현 후, 또는 메인 브랜치에 병합하기 전에 사용해야 합니다. 이 리뷰는 현재 구현체와 원래 계획을 비교하여 문제를 조기에 발견하는 데 도움이 됩니다.

스킬 보기

connect-mcp-server

디자인

이 스킬은 개발자들이 HTTP, stdio 또는 SSE 전송 방식을 통해 MCP 서버를 Claude Code에 연결하는 포괄적인 가이드를 제공합니다. GitHub, Notion 및 사용자 정의 API와 같은 외부 서비스를 통합하기 위한 설치, 구성, 인증 및 보안을 다룹니다. MCP 통합 설정, 외부 도구 구성 또는 Claude의 모델 컨텍스트 프로토콜 작업 시 활용하세요.

스킬 보기

web-cli-teleport

디자인

이 스킬은 작업 분석을 기반으로 개발자가 Claude Code 웹 인터페이스와 CLI 인터페이스 중 선택할 수 있도록 돕고, 두 환경 간 원활한 세션 텔레포트를 가능하게 합니다. 웹, CLI 또는 모바일 환경 전환 시 세션 상태와 컨텍스트를 관리하여 워크플로를 최적화합니다. 다양한 단계에서 서로 다른 도구가 필요한 복잡한 프로젝트에 사용하세요.

스킬 보기