# Move master branch to main

This steps works for Github, Gitlab and your own git server.

## Move the master branch to main

git branch -m master main

## Push main

git push -u origin main

## Point HEAD to main

git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

## Change the default branch in (github, gitlab or git server)

Follow the instructions in your git provider to change the defual master

## Delete master branch

git push origin --delete master

## Check branch

git branch -a

You should have an output like

* main
  remotes/origin/HEAD -> origin/main
  remotes/origin/main

That’s it… you chanched the master branch to main

----------

----------

© DarknessCode - LinuxSucks