Search code examples
gitgithubintellij-ideaphpstorm

Can't checkout local branch using git plugin


For some reason I can't checkout local branch in IntelliJ IDEA (123.150) git plugin. I suspect I simply don't understand how it's supposed to work.

I thought that I have local branch if I cloned repo on my disk.

Here is what I did

  • Created new project via "Check out from Version Control".
  • IDEA shows I'm in git's master branch.
  • If I click in right bottom corner on "Git: master" label it shows list of remote branches and no local branches
  • If I click on remote origin/master and select Checkout as new local branch it gives me error saying Branch name master already exists.

I'm confused. Why it doesn't show any local branches ? If I don't have any why it doesn't let me create new one locally with name master ?


Solution

  • checkout is used for switching between branches or creating new ones in your repository. If you want to get the code from another repository, you need to use the pull or fetch commands. I don't know where these are in the IntelliJ plugin. I am simply using the names used at the command-line. Hopefully they will help you find what you need.