error: pathspec '…..' did not match any file(s) known to git ON LOCAL REPO

Issue

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

Solution

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

Answered By – ElpieKay

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published