Change:
Issue Type: <bBug</bthe local computer, create a default branch that is not master, such as main by typing the following: a new VSC folder and run the command Git: Initialize repository' and commit a file the repository usingPublish to GitHub'. In my case, I chose GitHub Public to the GitHub website and open the repository to find there is no code because it is using the branch. Oddly, you cannot select a new default branch with this use case (at least right now?) Note: I tried the option, but received errors informing me I had to pull, which resulted in additional errors. Ultimately it seems to have worked(?), but it does not feel like a good workflow. I think most people like myself will want to use the Publish to GitHub option and have it automatically sort out the fact you are pushing the configured default branch. VS Code version: Code 1.48.0 (, 2020-08-13T08:03:27.059Z) OS version: Darwin x64 19.6.0 <details<summaryExtensions (4)</summaryExtensionVersion ------ vscode-liquid-snippets2.0.0 language-liquid0.1.1 live-sass3.0.0 LiveServer5.6.1 </details<!-- generated by issue reporter --
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.472 --- <!-- score: 0.464 --<!-- potentialduplicatescomment --
It looks like it always uses when using . I am not entirely sure how to get the current branch to make a PR though.
In order to get the current branch, I think that we could use the method below to get the global configuration and then, based on the parameter, we could run the method. Does it seem feasible to you,
No, I would actually try to get the name of the current branch from the repo itself with .
I do not know how helpful this is, but GitHub links to this page as their official updates on how they are defaulting to : There is useful guidance on there, but it is not directed at developers who are creating tooling like VSC. Of course, GitHub is also enabling any default branch, which is why my concern with VSC is not just supporting , but any primary branch name. Hope this helps.
The PR I submitted will use whatever branch name is configured. Whether it is , , .
Thanks!
I initialized a git repo with branch name "whatever". It seems that 'Publish to GitHub' creates the repo, but it doesn't pick up the branch name? I tried cloning the created repo and it seems to be completely empty. !
Was there an error? How did you initialized the git repo with that branch name? This seems to work just fine for me: Then create one commit. Then publish to Github. !
I think if you commit and publish without any files, you get the empty repo without a branch.
This bug has been fixed in to the latest release of ! you can help us out by confirming things are working as expected in the latest Insiders release. If things look good, please leave a comment with the text to let us know. If not, please ensure you're on version of Insiders (today's or later - you can use in the command pallete to check), and leave a comment letting us know what isn't working as expected. Happy Coding!
I followed the steps in the original post, so I did not run or directly in a terminal. I also published with the file selected. Same result (empty repo after publish) after updating to today's insiders.
I'm seeing a lot going wrong here and will open a few new issues. But if I go down the "happy path" of not having a git repo at all, it now publishes to my local default branch, rather than the default branch I have setup on GitHub. I would expect it to use the GitHub defaults as I'm publishing there.
I am on vacation this week, so will test when I return
I would call this a separate issue, thanks for filling that as a separate one! This feature simply respects whatever branch you have created in your local repo.
closedWith
Thank you for looking into this, and sorry I could not test last week as I was on vacation. I downloaded the Insider's build (1.50.0-insider) and initialized two different local repos with different names for the mainline branch (one named and one named . Each repo includes a file that I commit before publishing. Each of those local repos published to GitHub without error. Opening the repos in GitHub, I see they are using the correct branch names I originally instantiated locally. Going one step further, I cloned each repo from GitHub to my local computer. The proper mainline branches pulled down. I was able to commit new files and sync without error. /verified
/verified

Discussion:
} progress.report({ message: 'Uploading files', increment: 25 }); <ins> const branch = await repository.getBranch('HEAD'); </ins> await repository.addRemote('origin', createdGithubRepository.clone_url); <del> await repository.push('origin', 'master', true); </del> <ins> await repository.push('origin', branch.name, true); </ins> return createdGithubRepository; });