you are viewing a single comment's thread
view the rest of the comments
[–] 7 points 11 months ago (4 children)

I usually create new repos through GitHub or another central repo's system, where it defaults to calling the main branch main. But I did recently create a new repo with my local Git's git init, and had to deal with a master branch on a completely new repo for the first time in a while. It was actually kinda a weird experience.

  • source
  • hideshow 4 child comments
  • [–] 8 points 11 months ago (1 child)

    If you haven’t already found it, you need to change your global git config (~/.gitconfig):

    git config --global init.defaultBranch main

    (or whatever you want to call it; e.g. daddy would work too)

    For any existing repositories you want to run the following command in the existing repository root (./.git/config):

    git config set init.defaultBranch main

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 11 months ago

    Yeah, current company has their internal git server default to master and it was a little odd first time I created a new repo. Luckily all the CI templates can recognize either name so I just switched it.

  • source
  • parent