From e1ada0175560dd64d2c93635d71ccafefcf52bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20St=C3=A4heli?= Date: Fri, 5 Dec 2025 11:45:03 +0100 Subject: [PATCH 1/2] Respect push.default=current configuration in push command When push.default=current is set in Git configuration, push to a remote branch with the same name as the local branch instead of pushing to the configured upstream branch. Fixes #182510 --- extensions/git/src/repository.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index b1e5a2f4ea881..cfbb76e87fb0b 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -2078,7 +2078,14 @@ export class Repository implements Disposable { if (head && head.name && head.upstream) { remote = head.upstream.remote; - branch = `${head.name}:${head.upstream.name}`; + + // Respect push.default=current configuration + const pushDefault = await this.repository.config('get', '', 'push.default'); + if (pushDefault === 'current') { + branch = head.name; + } else { + branch = `${head.name}:${head.upstream.name}`; + } } await this.run(Operation.Push, () => this._push(remote, branch, undefined, undefined, forcePushMode)); From 1dcc94941ab38589945faec596657584205d085f Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 5 Dec 2025 13:21:22 +0100 Subject: [PATCH 2/2] Update extensions/git/src/repository.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- extensions/git/src/repository.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index cfbb76e87fb0b..6ff5632fedb04 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -2080,7 +2080,7 @@ export class Repository implements Disposable { remote = head.upstream.remote; // Respect push.default=current configuration - const pushDefault = await this.repository.config('get', '', 'push.default'); + const pushDefault = await this.run(Operation.Config(true), () => this.repository.config('get', '', 'push.default')); if (pushDefault === 'current') { branch = head.name; } else {