Skip to content

Git - Support the "push.default=current" strategy #182510

@AndreyBelym

Description

@AndreyBelym

I experimented with the push.default strategies and discovered that the "Sync" button in the "Source Control" tab in the Activity bar and the "Git: Push" command in the Command Palette in VSCode 1.78.2 does something unexpected (for me at least) when git's push.default config is current and a local branch is tracking some remote branch with a different name.

I expected that VSCode will respect the setting and will behave similarly to the default push (git push without arguments), pushing changes to the remote branch named as a local branch instead of pushing the to the tracked upstream branch. Unfortunately, it didn't happen, VSCode still pushes new changes to the upstream branch.

Steps to reproduce:

  1. Setup a branch that tracks some remote branch with a different name:
$ git checkout -b feature/do-some-stuff origin/main
  1. Set push.default to current:
$ git config push.default current
  1. Do some stuff
$ git push --allow-empty -m test
  1. Push with the git CLI. The remote feature/do-some-stuff is created and updated.
$ git push
To <origin>:
 * [new branch]      feature/do-some-stuff -> feature/do-some-stuff
  1. Push with the "Sync" button and/or use the "Git: Push" command. It pushes changes to the remote main branch. I would expect that it will push to feature/do-some-stuff, as in step 4 (especially for the command).
<Press Sync>
<Git Output tab:>
To <origin>:
   f649920..9d6b5fc  feature/do-some-stuff -> main

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buggitGIT issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions