I know that this question has been asked many times, but I got this error simply by initializing a new repository. No remote branches. I’m just trying to create a new branch. All my commands I repeat NO REMOTE BRANCHES. My repo doesn't have any connection with another world. I create new directory , came into that, did
git init
git add .
git commit -m something
# I trying
git checkout -m new_branch
# and I get :
error: pathspec '.....' did not match any file(s) known to git
CodePudding user response:
I guess you want git checkout -b new_branch
, to create a new branch from the current head. -m
is a valid option, but in git checkout -m new_branch
the new_branch
should be an existing one. If it does not exist yet, it raises error: pathspec 'new_branch' did not match any file(s) known to git