Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
242 views
in Technique[技术] by (71.8m points)

git - Difference Between Main Branch and Master Branch in Github?

I tried git push on master branch but it just shows that I have new pull request but when I click on new pull request it takes me to comparing changes but doesn't show any option to add those changes into repository. It only shows changes I made.

enter image description here

enter image description here

But when I entered command

git push origin main

all files where added to my repository.

but when I do

git push origin master

it doesn't work. Why is it? I heard they are replacing master with main. So in future are they going to remove master?

question from:https://stackoverflow.com/questions/64249491/difference-between-main-branch-and-master-branch-in-github

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

GitHub is working on replacing the term "master" on its service with a neutral term like "main" to avoid any unnecessary references to slavery,

you can read here for more background the reason for the change https://www.zdnet.com/article/github-to-replace-master-with-alternative-term-to-avoid-slavery-references/

about renaming your branch from master to main: there are a lot of guidelines for example here https://jarv.is/notes/github-rename-master/

git branch -m master main
git push -u origin main
git remote set-head origin main


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...