HarshKapadia2 / git_basics

A PWA and TWA for Git and GitHub concepts and commands.
https://harshkapadia2.github.io/git_basics
Creative Commons Attribution Share Alike 4.0 International
105 stars 20 forks source link

replace master by main. #47

Open tusharnankani opened 4 years ago

tusharnankani commented 4 years ago

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.

HarshKapadia2 commented 4 years ago

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?

tusharnankani commented 4 years ago

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)

KartikSoneji commented 4 years ago

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.

HarshKapadia2 commented 4 years ago

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?

tusharnankani commented 4 years ago

👉 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!

HarshKapadia2 commented 4 years ago

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.

tusharnankani commented 4 years ago

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 commented 4 years ago

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.

HarshKapadia2 commented 4 years ago

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.

tusharnankani commented 4 years ago

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)

HarshKapadia2 commented 4 years ago

Handled in PR #57 for now.

HarshKapadia2 commented 3 years ago

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