Skip to content

Can't checkout new remote branch locally when two remotes have that same branch #54601

@segevfiner

Description

@segevfiner
  • VSCode Version: 1.25.1
  • OS Version: Ubuntu 16.04.4 amd64

Steps to Reproduce:

  1. Run:
git init --bare origin
git init --bare upstream
git clone origin clone
cd clone
git remote add upstream $(readlink -f ../upstream)
touch hello.txt
git add hello.txt
git commit -m "Initial Commit"
git checkout -b hello-text
echo 'Hello, World!' > hello.txt
git add hello.txt
git commit -m 'Add Hello, World! text'
git checkout master
git push -u origin master
git push -u origin hello-text
git push upstream master
git push upstream hello-text
git branch -D hello-text
code .
  1. Execute Git: Checkout to... on origin/hello-text.
  2. You get an error Git: pathspec 'hello-text' did not match any file(s) known to git..

The cause is VS Code running: git checkout q <branch-name>, which only works when the branch exists in exactly one remote (See git-checkout(1)), instead of something like: git checkout -q -t <remote>/<branch> , or any alternative more verbose/explicit git checkout command.

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buggitGIT issueshelp wantedIssues identified as good community contribution opportunitiesverifiedVerification succeeded

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions