有关github中的master和master分支的指南 [英] Guidance on main and master branch in github

查看:122
本文介绍了有关github中的master和master分支的指南的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Github中创建了一个远程存储库,并将我的项目推送到了该远程存储库中.推送后,将创建一个新分支 master ,现在我有两个分支 main master .默认分支为 main ,不应为该分支.在创建远程存储库时,我添加了一个 Readme.md 文件,可能是因为首先创建了 main 分支.你能在这里纠正我吗?

I had created a remote repository in Github and pushed my project into that remote repository. After pushing it, a new branch is created master and now I have two branches main and master. The default branch is main which shouldn't be. At the time of the creation of the remote repository, I have added a Readme.md file maybe because of that main branch is created in the first place. Could you correct me here?

到目前为止,我有两个分支,并将默认分支更改为 master .对于 main 分支,它显示为 main在43分钟前最近进行过推送 compare&拉请求按钮.当我单击按钮时,它显示如下.

As of now, I have two branches, and I changed the default branch to master. For the main branch, it is showing as main had recent pushes 43 minutes ago and compare & pull request button. When I clicked the button it is showing as below.

创建 main 分支后,是否是因为添加了Readme.md文件?我一个人在开发一个小项目时,如何发出请求请求?需要一些指导.

When the main branch is created, Is it because of adding Readme.md file? How can I do a pull request as I am developing a small project alone? Need some guidance on that.

推荐答案

最近,GitHub决定更改默认值创建新的 main 存储库后,分支.

Recently, GitHub has decided to change the default branch upon creating a new repo to main.

如果您在 main 中没有任何提交并且不需要它,只需删除该分支即可.

If you don't have any commits in main and you don`t need it, just delete that branch.

您发布的屏幕快照显示,两个分支之间没有什么可比较的,并且由于您已经将 master 设置为默认值,而不是将 main 设置为默认值,因此您不必真的不需要 main .

The screenshot you posted shows that there isn't anything to compare between the two branches and since you already made master the default, instead of main, you then don't really need main.

如果您需要删除 main ,可以通过GitHub UI或命令行(

If you need to delete main there are many ways, either through the GitHub UI or command line (related).

修改

GitHub现在提供了一个设置,允许您通过 https:/将默认分支的名称更改为每个存储库/github.com/settings/repositories .在这里,您可以还原为主"作为您的默认分支名称.

GitHub now provides a setting that allows you to change the name of the default branch to every repository through https://github.com/settings/repositories. Here you can revert back to "master" as your default branch name.

这篇关于有关github中的master和master分支的指南的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆