git_basics icon indicating copy to clipboard operation
git_basics copied to clipboard

replace master by main.

Open tusharnankani opened this issue 3 years ago • 12 comments

Since from now on all repositories have default branch main, I think either all masters on the website should be replaced by main, or a notification on top of the page could be given for now.

tusharnankani avatar Oct 09 '20 14:10 tusharnankani

Thank you so much for bringing this up, @tusharnankani!

Till GitHub doesn't start the change, I don't think I should replace master with main everywhere in the doc. Also, git_basics doesn't only cater to GitHub, so I will have to look into catering to platforms which use master once GitHub stops using it. I can definitely have a notice at the beginning of the document or something though.

Thoughts, @KartikSoneji?

HarshKapadia2 avatar Oct 09 '20 14:10 HarshKapadia2

Umm, it has started! For all the new repositories, the default branch is main, and it will remain master for the old ones.

Screenshot (645)

tusharnankani avatar Oct 09 '20 14:10 tusharnankani

Note that the master to main change is only by GitHub, so I think you should add a note about it in the GitHub section, not anywhere else.

KartikSoneji avatar Oct 09 '20 15:10 KartikSoneji

I think the repositories that are created on GitHub with a README.md file or any other file initially added using the web app (as shown in the two images below) uses the main branch as the default branch. If no file is chosen and Git Bash is used to upload files, the default is still master (as shown in the third pic).

👉 Repo with no files initially added:

👉 Repo with README.md added initially uses the main branch.

👉 Repos created locally are still using master as the default branch, so if the main branch is to be used, then a repo with the main branch as the default branch will have to be cloned or the default local branch in Git 2.28.0 will have to be changed using the command git config --global init.defaultBranch <branch_name> for new local repos created using git init.


So for new repos, I feel that these changes definitely can and should be made.

For existing repos, GitHub has adviced waiting until the end of this year.

For now, there are some workarounds and methods for existing repos like retarget_prs and Scott Hanselman's blog post.


As far as git_basics is concerned, most of the content is catered towards Git rather than GitHub and Git has not made any changes to the default branch yet. Git is in the process of making changes, the first of them being the introduction of --global init.defaultBranch <branch_name> to the git config command as said in the description of the 3rd image. Also, I think a lot of the users of git_basics are quite new to Git and all other resources are using master, so these changes will make it difficult for them to grasp things right now, in my opinion. That being said, a note informing people about this shift can be added for now and final changes can be made when things become more concrete and simpler to follow for absolute newbies.


Thoughts?

HarshKapadia2 avatar Oct 09 '20 16:10 HarshKapadia2

👉 Repo with README.md added initially uses the main branch.

Alright, thank you so much for clarifying that!

So for new repos, I feel that these changes definitely can and should be made.

I think the notice at the beginning of the webpage would work the best as of now, and for more information regarding this, you could direct them to this issue!

tusharnankani avatar Oct 09 '20 16:10 tusharnankani

I think the notice at the beginning of the webpage would work the best as of now, and for more information regarding this, you could direct them to this issue!

Would you want to work on a PR for that? If not, I'll do it. No issues. Just let me know.

HarshKapadia2 avatar Oct 09 '20 16:10 HarshKapadia2

Would you want to work on a PR for that?

I would be glad to! I will start working on it as soon as I get free!

tusharnankani avatar Oct 09 '20 18:10 tusharnankani

I just went through the directories. I have never worked with Asciidoctor, before.

I don't have to make direct changes to the index.html, right? If yes, which .adoc file do I have to make the changes to? Or do I have to create one? I will figure out how to edit a .adoc file.

tusharnankani avatar Oct 09 '20 19:10 tusharnankani

I have never worked with Asciidoctor, before.

No problem! The CONTRIBUTING.md file can help you get started and you can always ask me any doubts.

I don't have to make direct changes to the index.html, right?

You don't have to make changes to the index.html file, but you have to generate it using Asciidoctor and make sure to generate and include it every time there is a change in any .adoc file.

which .adoc file do I have to make the changes to?

Depends on where you want to include the message. The CONTRIBUTING.md file has the file hierarchy on how Asciidoctor parses files. Everything starts with index.adoc. This might help you to understand where you want to include the message.

HarshKapadia2 avatar Oct 09 '20 20:10 HarshKapadia2

Hi @HarshKapadia2

Depends on where you want to include the message.

Screenshot (655)

I am planning to add the notice, before the Abstract, after the main heading - git_basics. So, I will be making changes to src/index.adoc

Also, I will an Admonition - NOTE. Let me know, any of these is to be used instead of Note^

Screenshot (656)

tusharnankani avatar Oct 11 '20 08:10 tusharnankani

Handled in PR #57 for now.

HarshKapadia2 avatar Oct 13 '20 08:10 HarshKapadia2

From a comment above:

For [renaming] existing repos ['master' branch], GitHub has adviced waiting until the end of this year.

UPDATE: GitHub now supports renaming the default branch. Existing PRs, branch rules and more are all re-targeted automatically. image Message for local update 👇 image

HarshKapadia2 avatar Feb 20 '21 21:02 HarshKapadia2