resolve-git-conflicts
について
このClaudeスキルは、開発者がGitのマージやリベースの競合を安全な回復オプションとともに解決することを支援します。競合の原因を特定し、マーカーを読み取り、解決策を提案し、操作の安全な継続または中止を可能にします。gitのマージ/リベース/チェリーピック/スタッシュポップまたはプル操作で競合が報告された際にご利用ください。
クイックインストール
Claude Code
推奨npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit 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 mergeorgit rebasereports conflictsgit cherry-pickcan't apply cleanlygit pull→ conflictsgit stash popconflicts 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
<<<<<<< HEADto=======: 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 statusshows clean tree - Merge/rebase history correct in
git log - Tests pass after resolution
- No unintended changes introduced
Traps
- Blindly accept one side:
--ours/--theirsdiscards 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
--amendunless step specifically calls for it. Usegit rebase --continueinstead. - Lose work on abort:
git rebase --abort+git merge --abortdiscard 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 resolutionmanage-git-branches— branch workflows leading to conflictsconfigure-git-repository— repo setup + merge strategies
GitHub リポジトリ
関連スキル
executing-plans
デザインexecuting-plansスキルは、完全な実装計画があり、それを管理されたバッチでレビューチェックポイントを設けながら実行する場合に使用します。このスキルは計画を読み込んで批判的にレビューした後、小さなバッチ(デフォルトは3タスク)でタスクを実行し、各バッチの間に進捗状況を報告してアーキテクトのレビューを受けます。これにより、品質管理チェックポイントが組み込まれた体系的な実装が保証されます。
requesting-code-review
デザインこのスキルは、コードレビュアーサブエージェントを起動し、処理を進める前に要件に対してコード変更を分析します。タスク完了後、主要な機能の実装後、またはmainブランチへのマージ前などに使用すべきです。このレビューは、現在の実装と元の計画を比較することで、問題を早期に発見するのに役立ちます。
connect-mcp-server
デザインこのスキルは、開発者がHTTP、stdio、またはSSEトランスポートを使用してMCPサーバーをClaude Codeに接続するための包括的なガイドを提供します。GitHub、Notion、カスタムAPIなどの外部サービスを統合するためのインストール、設定、認証、セキュリティについて解説しています。MCP統合のセットアップ、外部ツールの設定、またはClaudeのModel Context Protocolを扱う際にご利用ください。
web-cli-teleport
デザインこのスキルは、タスク分析に基づいて開発者がClaude Code WebとCLIインターフェースの選択を支援し、これらの環境間でのシームレスなセッションテレポーテーションを可能にします。Web、CLI、モバイル環境を切り替える際のセッション状態とコンテキストを管理することで、ワークフローを最適化します。様々な段階で異なるツールを必要とする複雑なプロジェクトにご活用ください。
