Renaming your git master branch to main

If you've gotten a certain urge to rename your git master branch to something else, here's how to rename it to main:

Select branch
git checkout master

Rename it
git branch -m master main

Get latest from your repository 
git fetch

Remove upstream information
git branch --unset-upstream

Set a new upstream
git branch -u origin/main

Let HEAD point to your new branch
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

Hope this helps

Comments

Popular posts from this blog

Auto Mapper and Record Types - will they blend?

Unit testing your Azure functions - part 2: Queues and Blobs

Testing WCF services with user credentials and binary endpoints