協助解決 Git Rebase 或 Merge 過程中的衝突,提供系統化的衝突解決流程。
Detects git rebase/merge conflicts and guides you through resolving them. Shows conflict details, offers resolution options (ours/theirs/manual merge), and completes the process with `git rebase --continue` or `git commit`.
/plugin marketplace add MilesChou/claude-marketplace/plugin install git@mileschou-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
協助使用者系統化地解決 Git Rebase 或 Merge 過程中的衝突。
檢查當前是否處於衝突狀態:
git status
確認是 rebase 還是 merge 衝突:
rebase in progressYou have unmerged paths使用以下指令列出所有衝突的檔案:
git diff --name-only --diff-filter=U
或從 git status 中擷取:
git status --short | grep "^UU\|^AA\|^DD\|^AU\|^UA\|^UD\|^DU"
對於每個衝突的檔案:
讀取檔案內容
<<<<<<<, =======, >>>>>>>)展示衝突資訊
檔案:src/example.ts
衝突位置:第 10 行
衝突內容比對:
<<<<<<< HEAD (當前分支)
const value = "version A"
=======
const value = "version B"
>>>>>>> 合併進來的分支
使用 AskUserQuestion 提供解決選項
執行解決
標記為已解決
git add <檔案路徑>
所有衝突解決後:
Rebase:
git rebase --continue
如果遇到「You must edit all merge conflicts」錯誤,可能是索引狀態不一致,使用以下方式重置:
git reset && git add <已解決的檔案> && git rebase --continue
Merge:
git commit
如果需要放棄:
git rebase --abortgit merge --abortgit rebase 時遇到衝突git merge 時遇到衝突簡單衝突:
git checkout --ours <檔案> # 保留當前分支的版本
git checkout --theirs <檔案> # 採用合併進來的版本
複雜衝突:
[執行 rebase 時遇到衝突]
User: 我在 rebase 時遇到衝突了,幫我解決。
Agent: 偵測到 rebase 衝突,有 2 個檔案需要解決:
1. src/auth/login.ts
2. README.md
開始解決第一個衝突...
檔案:src/auth/login.ts
衝突位置:第 15 行
衝突內容比對:
<<<<<<< HEAD (當前分支)
if (user.verified) {
return authenticateUser(user)
}
=======
if (user.isVerified && user.active) {
return authenticate(user)
}
>>>>>>> feature/new-auth
Agent: [使用 AskUserQuestion]
要如何解決這個衝突?
選項:
1. 保留當前版本(user.verified)
2. 採用新版本(user.isVerified && user.active)
3. 整合:保留 isVerified 和 active 檢查,使用 authenticateUser
4. 其他自訂方案
User: [選擇選項 3]
Agent: 已解決 login.ts 並標記為已解決。
繼續處理 README.md...
[展示衝突並詢問]
User: [選擇保留雙方的文件更新]
Agent: 所有衝突已解決,執行 git rebase --continue
Rebase 成功完成!
User: [確認結果並繼續開發]
避免:
推薦:
二進位檔案衝突:
# 只能選擇其中一個版本
git checkout --ours <二進位檔案>
# 或
git checkout --theirs <二進位檔案>
檔案刪除衝突:
解決衝突後建議:
reviewers:requesting-code-review 檢視解決方案Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.