bug: git-worktree 在默认分支不是 main 的目标仓库中会选错或选不到 base

未关闭
#335 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Casper-Mars 已经在做这个了。

开始于 2026年11月4日。

  • #340 来自 @Casper-Mars —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
git
领域
tooling

调研方向

Read .agents/skills/git-worktree/SKILL.md at line 21 and compare it with the documented base selection in the git-branch skill and the README’s install behavior. Check how base selection handles repositories whose default branch is not main; done means worktree creation uses the target repository’s documented default base when available and has a defined fallback.

由索引模型根据 Issue 内容生成。

描述

area:skills bug repro:high triaged

问题位置

.agents/skills/git-worktree/SKILL.md:21

触发条件

通过 install.sh 接入的目标仓库默认分支为 master、trunk 等其他名称,用户执行 $git-worktree 且未自行指定 main。

实际影响

如果 origin/main 和本地 main 都不存在,创建 worktree 的命令会失败;如果恰好存在一个陈旧或无关的 main,则 worktree 会从错误分支创建,后续提交和 PR base 都可能错误。

核实依据

第 21 行把默认 base 硬编码为 main,后续只尝试 origin/<base> 和本地 <base>,没有读取仓库默认分支或 origin/HEAD。同仓库的 git-branch SKILL 要求先使用仓库 documented base,否则才回退到 main;README 又明确说明这些 skill 会安装到任意 target repo,因此非 main 默认分支是现实场景。

扫描提交:3a720aab9db9e01a3d53d7ddb4985a2d74e58cbb;扫描日期:2026-11-04(北京时间);轮巡分片:34/90。

主要语言
Python
星标
171
派生
24
平均合并
3 小时 13 分钟
30 天内合并 PR
13

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Terry-Mao/AICodingFlow 的其他 Issue

查看 Terry-Mao/AICodingFlow 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。