Skip to content

Git initial-branch option ignored #23592

Discussion options

You must be logged in to vote

git init won’t delete existing branches if you call it again in an existing repository, that’s a good thing. In general, there’s no reason to call git init in an existing repository. 😉

In your existing repository you can just rename the branch:

git branch -m master main

For a new repository that init command should work, or you could set the init.defaultBranch option to change what git init does without the parameter.

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants