github / github/app

Worktree/session creation should fetch latest `origin/master` before branching

未关闭
#2,278 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
Bugs
主要语言
没有语言数据
星标
2.1k
派生
153
PR 合并指标
30 天内没有已合并 PR

描述

### Short summary

_No response_

### Affected version or release

_No response_

### Installation context

_No response_

### What happened?

When creating a new session/worktree, the app branches from the local `origin/master` remote-tracking ref without first running `git fetch`. If the main checkout hasn't fetched recently, new sessions silently start from a stale snapshot of master instead of the true latest remote commit.

**Proposed solution:**

Run `git fetch origin ` before creating the new branch/worktree, so every new session reliably starts from the actual latest commit on the remote default branch. At minimum, surface a warning if the local `origin/` ref is behind the real remote.

**Workflow impact:**

Affects anyone using the app for parallel/worktree-based sessions. Can lead to merge conflicts or duplicated work discovered only by manually diffing against remote — as happened to me just now (branch was created 1 commit behind actual origin/master).

## **Additional context:**

Confirmed via `git reflog show ` → "Created from origin/master", while `git status -sb` on the main checkout showed "behind 1" vs the real remote at creation time.

### Steps to reproduce

_No response_

### Expected behavior

_No response_

### Additional context

_No response_

贡献指南

打开贡献指南

调研方向

首先定位 session/worktree 创建流程,以及从本地 origin/default-branch ref 分支出的逻辑。追踪应用在创建 branch 之前如何调用 Git,然后为过时的 remote-tracking ref 添加覆盖测试;完成标准是新的 worktree 基于最近 fetch 的 default branch,或者显示文档中说明的警告。

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

评估

技术栈
git
领域
desktop, developer-experience
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

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