79724242

Date: 2025-08-03 18:29:05
Score: 0.5
Natty:
Report link

When I ran git branch -m master main before having made any commits, I got this error:

error: refname refs/heads/master not found
fatal: Branch rename failed

Git needs there to be at least one commit on the branch before you can work with it in this way. See this related question: git: rename local branch failed.

Do the initial commit:

$ git add -A
$ git commit -m "Initial commit"

Then the accepted answer works:

$ git branch -m master main
$ git status
On branch main
nothing to commit, working tree clean
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): When I
  • Low reputation (0.5):
Posted by: Matt