The Wayback Machine - https://web.archive.org/web/20200912131817/https://github.com/microsoft/vscode/issues/105025
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to GitHub uses master instead of default #105025

Open
BillRaymond opened this issue Aug 19, 2020 · 7 comments · May be fixed by #105878
Open

Publish to GitHub uses master instead of default #105025

BillRaymond opened this issue Aug 19, 2020 · 7 comments · May be fixed by #105878

Comments

@BillRaymond
Copy link

@BillRaymond BillRaymond commented Aug 19, 2020

Issue Type: Bug

  1. On the local computer, create a default branch that is not master, such as main by typing the following: git config --global init.defaultBranch main
  2. Create a new VSC folder and run the command `Git: Initialize repository'
  3. Create and commit a readme.md file
  4. Publish the repository using `Publish to GitHub'. In my case, I chose GitHub Public
  5. Go to the GitHub website and open the repository to find there is no code because it is using the master branch. Oddly, you cannot select a new default branch with this use case (at least right now?)

Note: I tried the Publish branch 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 (db40434, 2020-08-13T08:03:27.059Z)
OS version: Darwin x64 19.6.0

Extensions (4)
Extension Author (truncated) Version
vscode-liquid-snippets kil 2.0.0
language-liquid nei 0.1.1
live-sass rit 3.0.0
LiveServer rit 5.6.1
@vscodebot
Copy link

@vscodebot vscodebot bot commented Aug 19, 2020

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@nrayburn-tech
Copy link
Contributor

@nrayburn-tech nrayburn-tech commented Aug 27, 2020

It looks like it always uses master when using Publish to Github.

await repository.push('origin', 'master', true);

I am not entirely sure how to get the current branch to make a PR though.

@AndreaRe9
Copy link

@AndreaRe9 AndreaRe9 commented Sep 1, 2020

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 defaultBranch parameter, we could run the repository.push() method. Does it seem feasible to you, @joaomoreno?

getGlobalConfig(key: string): Promise<string>;

@joaomoreno
Copy link
Member

@joaomoreno joaomoreno commented Sep 1, 2020

No, I would actually try to get the name of the current branch from the repo itself with git symbolic-ref --short HEAD.

@BillRaymond
Copy link
Author

@BillRaymond BillRaymond commented Sep 2, 2020

I do not know how helpful this is, but GitHub links to this page as their official updates on how they are defaulting to main:
Renaming the default branch from master

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 main, but any primary branch name. Hope this helps.

@nrayburn-tech
Copy link
Contributor

@nrayburn-tech nrayburn-tech commented Sep 2, 2020

The PR I submitted will use whatever branch name is configured. Whether it is master, main, something-else.

@BillRaymond
Copy link
Author

@BillRaymond BillRaymond commented Sep 2, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.