M
M
Modest Petrovich2020-12-21 07:27:14
git
Modest Petrovich, 2020-12-21 07:27:14

How to change the default branch name in Git (master -> main)?

When you create a git repository for a project, the master branch is created. This branch has to be renamed manually each time using the git branch -m master main command.
Is it possible to change the default master branch name?
Note. Without renaming in the github, the master branch is created as a pull request to the main branch.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Komarov, 2020-12-21
@Graf_Duku

Since version 2.28 you can use init.defaultBranch

A
Alexander, 2020-12-21
@shabelski89

git branch -m master main

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question