How to change your default git branch from master to main?

Issue

A git repository uses the master branch and needs to be switched to main branch.

Solution

1 — Create a new branch locally:

git checkout -b main

2 — Delete the old default/master branch locally:

git branch -D master

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Git Cherry-pick: Merge Only the Selected Commits in Git CLI and GUI

How to Choose the Right Career Path in Software Development

Software Engineers writing code.

Understanding the Depth-First Search and the Topological Sort with Python

Quick Setup: Configuring Wildcard Certificate Issuer using LetsEncrypt & AWS Route 53 on Kubernetes…

Salesforce to ZeroBounce Integration

Software Engineer’s Path to Success

Map, reduce and filter

Lambda Layer Management with the IOpipe CLI

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
Lu Daley

Lu Daley

More from Medium

Git and GitHub (Part-1)

Git Cheat Sheet

Git Cheat Sheet

GIT basics for beginners

Git And Github For Beginners.