By default, git provides master as the default branch. This lesson shows how to get round that and use an alternative as the default branch for an existing repo.
Kevin Cunningham: 0:00 This is my blog, which I've had for a while. You can see my default branches at the master. What I'm going to do is I'm going to create a new branch in my local. I will make sure that I've pushed up all my changes. Everything's up to date. Great.
0:19 What I'm going to do now is I'm going to create a new branch main, like that. Then, I'm going to push that branch up to GitHub. That will fail because I haven't created it in the upstream, so I'm going to go create --set-upstream origin main. If I refresh my GitHub page, I can see I do have now a main branch.
0:51 What I'm going to do now is I'm going to go to Settings. I'm going to go to Branches. Here, it says my default branch and it's set to master. I'm going to switch that to main and update that. My default branch is now main.
1:11 Finally, I just want to remove that branch. I'm going to go to branches. I see that's main. I have these other branches. I'm going to just delete the master branch. That's it. Master branch is gone.