All GitHub repositories starts to switch from master to main from 1 October 2020. Despite the change, it is not enforced that the master branch will face with any significant problems if anyone continues to use. However, new repository created will use the main branch as the default.
Since most new projects will now start with the main branch as the default, we would like to reduce the need to re-configure between master and main.
Luckily, git allows us to do this quickly and easily from the global configuration.
There are two ways we can do so.
~/.gitconfig file directly with the following changes.[init]
defaultBranch = maingit config --global init.defaultBranch mainWith the new configuration, we will now be able to create git repositories with the branch being created as main right from the onset.
Of course, certain organisations may use very different naming for their default branch and we can use the same way to make the changes accordingly.