Chuyển đến nội dung
Skillpedia
Lập trình chung13k · #11387

merge-resolve-conflicts

Skill này làm gì

Skill hướng dẫn agent AI cập nhật nhánh làm việc của bạn với nhánh mặc định và giải quyết xung đột. Skill dành cho lập trình viên làm việc trên nhánh hoặc worktree git.

Khi nào nên dùng

  • ✓Khi nhánh của bạn đang chậm hơn main và bạn muốn gộp các thay đổi mới nhất.
  • ✓Khi git báo xung đột merge mà bạn cần trợ giúp để giải quyết.
  • ✓Khi bạn có thay đổi chưa lưu và cần quyết định cách stash hoặc commit chúng trước khi merge.

Liên kết skill

https://github.com/humanlayer/humanlayer/blob/main/.claude/skills/merge-resolve-conflicts/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/humanlayer/humanlayer/blob/main/.claude/skills/merge-resolve-conflicts/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Merge main mới nhất vào nhánh của tôi và giúp tôi sửa mọi xung đột.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent lấy các thay đổi mới nhất, kiểm tra trạng thái nhánh của bạn, và hỏi trước khi chạm vào công việc chưa lưu. Sau đó agent xử lý các xung đột cùng bạn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

You are either on a branch in a repository, or you are on a git worktree for a specific branch. You are responsible for ensuring the default branch (usually main or master, but not always) is merged into the current branch.

Begin by running git fetch.

Then:

Step 1: Orientation

First, you must determine if you are on a worktree for a repository OR if you are on a regular branch on a repository OR if you are on the default branch for the repository

Second, you must determine if the branch you are on has changes on upstream / origin (as configured) that you do not have on your local branch

Third, you should determine if there are existing merge conflicts on your branch already by running git status.

Fourth, you should determine if the user has both an origin and an upstream configured.

Important: if the user is working across multiple repositories, you should ask them which repository(ies) they would like help merging in.

Step 2: Action

Depending on the results of your orientation you should take one of the following actions:

  • If the user has unstaged changes which do not include merge conflicts or an ongoing merge: offer to either stash and merge, or to commit before merging, Then proceed with the following once the user answers:
  • If there are existing merge conflicts on your current branch: proceed to "Conflict Resolution Procedure" and follow those instructions.
  • If you are on a worktree or branch which is not for the default branch, and there are no merge conflicts:
    • if the user has both upstream and origin configured: fetch the defualt branch from the upstream and then merge it into the current branch. Proceed to the "conflict resolution procedure" steps.
    • if the user has only origin configured: fetch the default branch from the origin and merge it into the current branch. Proceed to the "Conflict resolution procedure" steps.
  • If you are on the default branch and there are no merge conflicts and no changes on origin/upstream: Indicate this to the user and ask what they would like you to do.

Conflict Resolution Procedure

  1. Read the ticket.md and structure outline artifacts. These should contain sufficient context about the user's task and what they are working on. You may later read the plan file if you determine that more information is needed.
  2. Use sub-agents to analyze the git state on the current branch and on the branch the conflicts come from to understand what was done and why they diverge.
  3. Use sub-agents to read the entire file for each conflict, as well as key relevant code and modules to understand the scope and nature of each conflict
  4. For each conflict (not necessarily each individual confict, e.g. group two related conflicts in the same file together e.g. for a function change and an import change for it), provide an analysis to the user of: a. What is on HEAD b. What is on the branch that the conflict is coming from (probably main or the other default branch) c. Based on the scope of the current task, recent commits to it and to the branch where the source of the conflict is coming from, how you recommend resolving it (keep HEAD, keep other branch, merge them), and why Keep your analysis concise, offer to provide more detail to the user if they ask.
  5. Ask the user how they would like to proceed for each one.
  6. Work back and forth with the user to resolve all conflicts. Only make changes that the user explicitly asks for - e.g. do not resolve a conflict until the user confirms the approach or instructs you to make the change.
  7. Once all merge conflicts are resolved, ask the user if they would like you to commit and push. If they confirm, you should write a conventional commit-style message indicating the branch merged in (from what commit hash), and a full body that indicates what each of the conflicts resolved was and how it was resolved and why.

IMPORTANT: Update your todo list to include items 1-7. You MUST stop and ask the user how they would like to proceed after presenting the analysis from step 4. You MUST work back and forth with the user until all conflicts have been resolved before proceeding to stop 7. The user may only give you instructions / guidance on some of the changes at a time - you should use the todo tool to track which ones have been completed and which ones still need resolution in your todo list.

Câu hỏi thường gặp

Nó có commit thay đổi của tôi giúp tôi không?

Nó hỏi trước. Nếu bạn có thay đổi chưa lưu, nó đề nghị stash hoặc commit chúng trước khi merge.

Nó có làm việc trên nhiều repository không?

Nếu bạn làm việc trên nhiều repository, nó hỏi bạn muốn giúp merge ở repository nào.

Nó có kiểm tra remote trước không?

Có. Nó kiểm tra remote nào đã được cấu hình và nhánh remote có thay đổi nào bạn chưa có không.

Chi tiết

Mô tả gốc của tác giả

Use to merge in main and resolve open merge conflicts.

repo: humanlayer/humanlayer

Độ phổ biến

Sao GitHub
13k
Vị trí xếp hạng
#11387
Giấy phép
Apache-2.0
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự