On Fri, Jun 3, 2022 at 2:49 PM Ian Molton <git-ian@xxxxxxxxxxxxxx> wrote: > Why does a bare repo even have a HEAD file? All repositories (bare or not) *must* have a `HEAD` setting. This contains the name of the current branch, or, if the repository is in detached-HEAD mode, the hash ID of the current commit. In a new repository (bare or not), there are no commits, so there cannot be a *current commit*. A branch name is also constrained to contain a valid hash ID, and there are no valid hash IDs, so there are no branch names. Nonetheless you are still "on" some branch: it's just an *unborn* (or "orphan") branch. In this mode, making a commit causes the branch name to spring into existence. So if your new empty repository is "on" `master`, the next `git commit` you run in that repository will create the branch `master`. As it's a bare repository, you probably will never run `git commit` there. As Junio noted, the current branch is the branch name that a Git repository "recommends" to another Git that is performing a `git clone` operation. This makes it the "default branch". Normally we'd use `git switch` or `git checkout` to change the *current* branch and thus change the default branch, but in a bare repository, we cannot do this (at least not without supplying a temporary working tree), so you must either use `git symbolic-ref` or resort to direct writing to `.git/HEAD` to change the default branch in the bare repo. The new `init.defaultBranch` configuration setting controls the name of the nonexistent branch you're on in a newly created repository. Given your setup you may wish to configure yours to be `main`. Last, note that you can re-create this "we are now on a branch that does not exist" status at any time you like (in an ordinary non-bare repository) using `git switch` or `git checkout` with the `--orphan` argument. (Watch out, there's a subtle difference between these two commands: use `git status` to observe the index state before committing.) Chris