284
you are viewing a single comment's thread
view the rest of the comments
[-] Zagorath@aussie.zone 6 points 11 hours ago

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.

[-] pageflight@lemmy.world 2 points 1 hour 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.

[-] NuXCOM_90Percent@lemmy.zip 19 points 11 hours ago* (last edited 11 hours ago)
git checkout -b main
git branch -D master
git config --global init.defaultBranch main

You don't have to deal with shit if you don't want to.

[-] dohpaz42@lemmy.world 5 points 11 hours ago

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

this post was submitted on 09 Dec 2025
284 points (98.3% liked)

Programmer Humor

27778 readers
1555 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS