git - Why am I unable to create/checkout this branch? -


i trying create local git branch, not working. here commands using:

tablet:edit11$ git checkout -b edit_11 switched new branch 'edit_11' tablet:edit11$ git checkout edit_11 error: pathspec 'edit_11' did not match file(s) known git. tablet:edit11$ git branch tablet:edit11$ 

what's going on?

you created , "switched to" branch called edit_11 when ran

git checkout -b edit_11 

however, (incl. empty git branch output) indicates have initialised repository , have yet made make initial commit. if there no commit, branches have nothing useful point @ , there nothing check out.

therefore, when run

git checkout edit_11 

you following error,

error: pathspec 'edit_11' did not match file(s) known git. 

even though branch edit_11 exists.


the problem can reproduced follows:

$ mkdir testgit $ cd testgit $ git init initialized empty git repository in /xxxx/testgit/.git/ $ git checkout -b edit_11 switched new branch 'edit_11' $ git checkout edit_11 error: pathspec 'edit_11' did not match file(s) known git. $ git branch $ 

after make first commit on branch edit_11, git checkout edit_11 not longer throw error. note no-op, here, because current branch edit_11.

$ printf foo > readme $ git add readme $ git commit -m "add readme" [edit_11 (root-commit) 90fe9c1] add readme  1 file changed, 1 insertion(+)  create mode 100644 readme $ git branch * edit_11 $ git checkout edit_11  on 'edit_11' 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -