Is it problematic in a git repo to not commit to master when preferring to use a different initial branch?

Viewed 17

After running git init in an app's source code install folder, the default branch is master; however, some members don't like the master name, so we may create another branch to use as the base branch.

So say I init locally, then run git branch -b main (which creates the branch then checks it out), then do commits and pushes from there.

My question is whether not committing to master ever could cause some sort of problem in git, since it uses that as its default branch, and may refer to it in some functionality as a default, at which point I imagine some unexpected behavior could happen if there's no commits there.

Anyway, this may be a silly question, and while I haven't run into an issue yet, that doesn't mean nobody else has, so I'd rather know from someone if they learned they should have committed to master before making a new base branch.

1 Answers

No. Branch name is just a matter of preference. The original default "master" was of historical reason with no real technical significant.

For older existing repo with many interlinking infrastructures, there might be admin reason(s) to keep the current naming. For new repo, your default can be whatever you please using.

Related