DEV Community

Discussion on: Replacing master in git

mburszley profile image
Maximilian Burszley

It's not a seven-step process, though, that was just a complete example for illustration. It's as simple as:

git init
git checkout -b main
Thread Thread
shaunagordon profile image
Shauna Gordon

Or, we can just do

git config --global init.defaultBranch main

once, and never have to worry about it again.

We also don't have to worry about alias syntax, which is terminal-type-dependent, and can include it in provisioning/dotfiles repos and it works regardless of the person's system. :)

Thread Thread
jnareb profile image
Jakub Narębski

This option was, as far as I know, not available at the time of writing the blog post in question, and possibly also when I was writing my comment.

Thread Thread
shaunagordon profile image
Shauna Gordon

It wasn't available yet (though it was already in the pipeline). I was responding to Max, whose response suggested that the addition wasn't necessary and the then-current workflow was sufficient.

Even if the latest release (with this config option) hadn't been out when I responded with the config, I still would have argued in favor of having it as a config option, with the same arguments of being able to set it once and not have to worry about terminal aliases, etc.

Some comments have been hidden by the post's author - find out more