Git: cannot checkout branch - error: pathspec '…' did not match any file(s) known to git

后端 未结 30 3293
太阳男子
太阳男子 2020-11-27 23:54

I\'m not sure why I\'m unable to checkout a branch that I had worked on earlier. See the commands below (note: co is an alias for checkou

30条回答
  •  春和景丽
    2020-11-28 00:53

    I got this when I did the following:

    • Used IntelliJ IDE, connected to git
    • Created a new file, and added to git
    • Renamed the new file

    When I tried to check in the directory, I got this error.

    To fix:

    I opened the repo in git extensions. I saw that the file (with the old name) was staged. But since it didnt exist anymore, it could not be committed.

    I simply unstaged this file.

    Then I re-added the file (this time correctly named) into git and committed without errors.

提交回复
热议问题