But it doesn't help for local repositories that don't have a remote. And it's ironic to need to use "origin" for that, which is itself a "master/main"-like default remote name.
that's what I mean: "main" is just the automatically created branch so that there is a branch for HEAD to point to in an empty repo. It's not special in any functional way locally. I.e. if I create "develop" and delete "main", locally nothing in git itself will ever miss "main" or needs to be told that "develop" is the primary branch, because that's not a concept locally (afaik). It knows the current branch (HEAD), that's it. So wanting to look it up locally doesn't make sense from gits perspective, although maybe the ability to tag a branch as such would be useful for some tooling, but it would in a way introduce the concept to git, not expose something it hides now.
Correct, this is the best way I've found. I have this as a git-alias:
But it doesn't help for local repositories that don't have a remote. And it's ironic to need to use "origin" for that, which is itself a "master/main"-like default remote name.