resolve-backport-conflicts

解决 Mergify 反向移植(backport)拉取请求中的合并冲突。当 cherry-pick 失败且 Mergify 提交包含冲突标记时,使用此技能。接受一个拉取请求链接或编号作为参数以定位并处理冲突。

仓库最近推送
GitHub Stars
184
Forks
65
Issues / PRs
14

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "resolve-backport-conflicts":https://skillpi.com/zh/skills/deepskill-9bc1b721bfb240c662b0ff06b454efbd6aa211e95aa84c74caadc1509d947946。安装前核对上游来源和版本:https://github.com/frappe/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

解决 Mergify 反向移植(backport)拉取请求中的合并冲突。当 cherry-pick 失败且 Mergify 提交包含冲突标记时,使用此技能。接受一个拉取请求链接或编号作为参数以定位并处理冲突。

0 下载

介绍来源: third_party · frappe · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: resolve-backport-conflicts
description: Resolve merge conflicts in a Mergify backport pull request. When a cherry-pick fails, Mergify commits the conflict markers as they are. This skill takes a pull request link or number as an argument.
disable-model-invocation: true

How Mergify leaves the branch

Mergify backports a pull request with a cherry-pick. When the cherry-pick conflicts, Mergify runs git add on the conflicted files and commits them unresolved. The branch then holds raw conflict markers:

<<<<<<< HEAD
content of the target branch, such as version-16-hotfix
=======
content of the commit under backport
>>>>>>> <sha> (commit subject)

The HEAD side is the target branch. The >>>>>>> side is the pull request under backport. Neither side wins by default.

Steps

1. Check out the pull request

Work inside the repository that owns the pull request. If the current directory is a different repository, clone the correct one into the scratchpad directory.

gh pr view <pr-url> --json number,title,body,baseRefName,headRefName,headRepositoryOwner,url
gh pr checkout <pr-url> --force

The --force flag resets a stale local branch to the pull request head. If the working tree is dirty, stop and tell the user. Do not discard the work of the user.

2. Read the original pull request

The Mergify description holds the line This is an automatic backport of pull request #<N>. Read the number from that line. If the line is absent, read the number from the branch name mergify/bp/<branch>/pr-<N>.

gh pr view <N> --json title,body,url
gh pr diff <N>

This diff states the intent of the backport. Read all of it before you edit a file.

3. Find every marker

git grep -nE '^(<{7}|={7}|>{7})' -- . || echo "no markers"
git diff HEAD~1 --stat
git log -1 --format=%s

The last command confirms that HEAD is the conflict commit of Mergify. Look also for leftover .rej and .orig files.

4. Resolve each conflict

  1. Read the code around the conflict until you know what it does on this branch.
  2. Start from the target branch side. It shows what the release branch holds today.
  3. Apply the change of the original pull request on top of that side.
  4. Drop every line that the diff of the original pull request does not contain.
  5. Delete the three marker lines.

Step 4 matters most. A conflict hunk drags in unrelated work from later commits on the source branch. Renamed helpers, new APIs, and unrelated refactors arrive this way. None of them belong in a release branch.

If the backport needs a function or a module that the target branch does not have, do not write a replacement. Report the gap and ask the user how to continue.

Mergify also stages clean hunks that belong to other commits. To catch these, compare the whole conflict commit against the diff of the original pull request. Revert the hunks that do not match.

5. Verify

git grep -nE '^(<{7}|={7}|>{7})' -- .
git diff HEAD

The first command must print nothing. Read every line that the second command prints. Compare git diff HEAD~1 against gh pr diff <N>. Apart from branch differences, the two diffs must match.

If the repository has a linter or a formatter, run it on the files you changed.

6. Commit and push

git add <modified files>
git commit -m "chore: resolve conflict"
git push <remote> HEAD:<headRefName>

To choose the remote, match headRepositoryOwner from step 1 against the output of git remote -v. A Mergify branch lives on the upstream repository, not on a fork. Never force-push.

7. Remove the conflicts label

Mergify adds a conflicts label when the cherry-pick fails. The label stays until someone removes it. After the push succeeds, and only if no marker remains, remove it:

gh pr edit <pr-url> --remove-label conflicts

The command fails if the pull request does not carry the label. That failure is harmless. If you could not resolve every conflict, leave the label in place.

8. Summarize

Report these points to the user:

  1. The backport pull request and the original pull request.
  2. Each file that held a conflict, with one line on how you resolved it.
  3. Each change you dropped as unrelated, with the reason.
  4. Each conflict you could not resolve.
  5. The sha of the pushed commit.

State the facts. If a resolution is a judgment call, say so.

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值78/100

亮点

  • 针对 Mergify 反向移植冲突这一明确开发痛点,提供端到端解决方案
  • 流程完整,覆盖从检出到推送的全生命周期
触发精准92/100

亮点

  • 触发条件清晰:Mergify backport PR 中的合并冲突
  • 输入参数明确:PR 链接或编号
结构规范95/100

亮点

  • 8个步骤划分清晰,逻辑连贯
  • 包含背景说明、具体命令、验证逻辑和出口条件
  • frontmatter 完整,文档结构规范
执行可靠85/100

待提升项

  • 子命令错误处理未覆盖 原报告严重程度:轻微

    未显式处理 gh pr checkout、gh pr view 等子命令执行失败的情况

    改进建议:建议在关键命令后添加错误检查逻辑,如 `|| { echo "Error: failed to checkout PR"; exit 1; }`

证据可验 (前四项均值)88/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。