The last thing we'll talk about here is in 2020.
I've mentioned this a few times.
GitHub decided to rename the default branch from master to Main.
Now we've seen that that doesn't really impact us, right?
We've been able to just push up a master branch and it's defaulting here to showing us master.
If I just go to this repo, we see master.
However, I do want to talk about it.
If we make a brand new repository, we'll just call this.
How about colors?
All right, here's our repo called colors.
There it is, colors.
And I'm going to create this repository, and maybe this time I'm going to initialize it with something.
So we'll learn about read meets.
But I'm just going to click this box and notice it tells me something different now, right?
It says this will set main as the default branch if I get rid of that.
It doesn't say anything about Main because there is no branch.
So when I create this repo as is with no read me just completely empty.
There is no branch that is initialized.
But as soon as I add a file to GitHub when I'm initializing this repository is what I mean, it automatically
needs to have a branch, right?
You can't have files in a git repo that are tracked and committed if they're not associated with some
branch.
So it defaults that branch name to main.
So we could change that in our settings so that it always defaults to master.
But you know, more and more people are using main anyway and that's kind of the push that GitHub is
working towards here.
So if we do this, I create this repository now it has a file in it, it has a commit initial commit
that was made for me, right?
I didn't say commit dash M or anything like that.
It just made me this read me file, which is something we'll learn more about in future sections.
So for now it's just a file and I'm on the main branch.
So in order to get this branch down to my machine, in order to work with it, I can clone this repository.
So I'll copy that and then I'll go over here and make sure I'm not in a repo.
Get clone that URL.
And then we have this colors repo, right?
And if you look at the branch, we're currently on its main.
So this makes it easy.
If we want to work on the main branch, we just clone it and we have the main branch.
But something that you may encounter is some companies or some projects may want to rename their branch
from master to Main to be in accordance with these.
They're not rules by any means from GitHub, but this new decision by GitHub.
So to do that, if you've been working on the master branch and you want to rename it to Main, it's
just like renaming any other branch so you can actually see instructions if you make a new repository,
I'm going to delete this, but if we make a new repository, it shows us, as we've talked about a couple
of times, what to do right.
It gives you instructions if you want to push an existing repository at a remote and then this line
renames the branch are currently on to be main.
Or here's another version of this.
If you don't have a repository yet, make a new repo, get in it, add some stuff to it, commit rename
the branch to main and then push your branch called Main up.
So I'll do this with our chickens demo.
I have this master branch, but if I want to rename it to main whoops is I need to go to that repository.
Geez I can't type back out of here.
Seed into chickens.
Right.
We have one branch which is master.
If I do get branch dash uppercase m main that renames my branch to main.
So now there is no master branch.
Right.
We just have main.
Remember there is no significance to the master branch name itself or to the master branch period.
It's just that you have to be working on a branch in git and by default the default branch name is master.
If you're working on Git on your machine, but on GitHub, the default branch name if you clone a new
repo that you have not created a branch on, but GitHub has made a branch it will default to main.
So don't get worried.
Don't freak out if you don't see master.
Right.
It's the exact same concept.
It's just a branch.
And GitHub made this decision recently to make main that default name.
So now I could push this branch up get push origin main.
And if we head over here.
If I refresh.
We still see the master branch, right?
But now we see Maine.
So there's Maine.
You'll see, though, that master is considered the default branch here.
That is because we pushed up Master first.
There was no main branch.
And so GitHub doesn't ignore a master branch.
I can change with the default branches on this project, but really you probably would not have main
in master in the same project.
What you would have is either a brand new empty project.
You clone it down and you start on the main branch, or you work on a project with your company or some,
some team and they decide we're not going to use the term master anymore.
We will rename to Main and then you can make Main the default.
I believe you go into settings and then we have branches and then I can decide that the default branch
is actually main.
And so now I've updated my project so that it defaults to showing me Main when I visit my repository.
So keep in mind through all of this, if you're confused, it's just a name.
Master is just a name for Branch in main, it's just a name for a branch.
The only complication comes if you have been working on one branch called Master and you change that
name.
If you change it locally, then you need to push up that new branch name to GitHub.
And then if you care about what your default branch is on GitHub, you need to change that.
But this is not some seismic shift.
It's just a branch name that you can change and you'll likely see more and more people using main rather
than master.
Though master is still incredibly common and it's still the default branch name on Git.