github / github/app

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

Open
#2,278 1 comment 1 reaction 0 assignees View on GitHub
Bugs
Dominant language
No language data
Stars
2.1k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

### 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_

Contributor guide

Open the contributing guide

Research direction

Start by locating the session/worktree creation flow and the logic that branches from the local origin/default-branch ref. Trace how the app invokes Git before branch creation, then add coverage for a stale remote-tracking ref; done means new worktrees are based on the latest fetched default branch or the documented warning is surfaced.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
desktop, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.