Skip to content

"Branch does not exist locally" while rebasing#8546

Merged
alexr00 merged 1 commit intomainfrom
alexr00/issue8487
Feb 25, 2026
Merged

"Branch does not exist locally" while rebasing#8546
alexr00 merged 1 commit intomainfrom
alexr00/issue8487

Conversation

@alexr00
Copy link
Member

@alexr00 alexr00 commented Feb 25, 2026

Fixes #8487

Copilot AI review requested due to automatic review settings February 25, 2026 15:06
@alexr00 alexr00 enabled auto-merge (squash) February 25, 2026 15:06
@alexr00 alexr00 self-assigned this Feb 25, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 25, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an issue in the Create PR webview flow where rebasing (detached HEAD) could trigger a misleading “Branch does not exist locally” error by ensuring the default compare branch is only set when a valid branch name is available.

Changes:

  • Add a guard in setDefaultCompareBranch to no-op when compareBranch or compareBranch.name is missing.
  • Remove non-null assertions around compareBranch.name and consistently use the validated branch name.
Comments suppressed due to low confidence (1)

src/github/createPRViewProvider.ts:687

  • this.changeBranch(...).then(...) is started but not awaited/returned and has no rejection handler. If changeBranch throws (e.g., getOrigin can throw when there are no GitHub repos), this becomes an unhandled rejection. Prefer await with try/catch, or at least attach a .catch(...) (and/or prefix with void) to make the fire-and-forget behavior explicit and safe.
		this.changeBranch(compareBranch.name, false).then(async titleAndDescription => {
			const params: Partial<CreateParamsNew> = {
				defaultTitle: titleAndDescription.title,
				defaultDescription: titleAndDescription.description,
				compareBranch: compareBranch.name,
				defaultCompareBranch: compareBranch.name,
				warning: await this.existingPRMessage(),
			};
			return this._postMessage({
				command: 'pr.initialize',
				params,
			});
		});

@alexr00 alexr00 merged commit dd73519 into main Feb 25, 2026
10 checks passed
@alexr00 alexr00 deleted the alexr00/issue8487 branch February 25, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Branch does not exist locally" while rebasing

3 participants