Here is my case:
But suddenly
You might encounter this error if you try to rename a branch into a namespaced (or folder) branch.
If it happens, go to the directories .git/logs/refs/heads/
and .git/refs/heads/
, and you'll see your branch is now a folder with a file inside it.
In both folders, move the file out to the folder's level, checkout that branch, delete the now empty folders and now you should be able to perform git checkout -b
without error, or git branch -M
.