Git/Github — Making the Switch from Master to Main

Why Should I do this?

Bottom Line, the industry is making the shift of naming a project’s default branch, “main”, from the prior standard, “master”. The change has already been happening so the sooner you get all your settings to change the less tricky it will be to make the adjustment later. So here are some steps in order to make the shift.

Changing Your Default Github Branch Name

Head over to account settings, then to the repositories section, and change the default branch name for new branches to main. Done!

Changing your local Git default branch name

As long as your git version 2.28 or above

git --version

Guide to Upgrade Git on Ubuntu

then you can run the following command

git config --global init.defaultBranch main

after this command anytime you make a new repository the initial branch will be called main instead of master.

That’s it, you are all set to go!

While we’re configuring git…

pushy(){git add .
git commit -m "$1"
git push $2 $3
}

the syntax to use…

pushy "message" remote branch

Alex Merced is a Full Stack Developer, learn more about his work at AlexMercedCoder.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store