Mthe beseti
Mthe beseti

Reputation: 619

I've deleted master branch on my local phpstorm

i'm new to phpstorm I've deleted master branch on my local phpstorm. How can i recreate it on phpstorm

Upvotes: 0

Views: 570

Answers (1)

jurglic
jurglic

Reputation: 3737

It depends how you deleted it and what have you done afterwards...

But the easiest and safest is to:

  1. Use git reflog to find last commit of master branch.

  2. Use git checkout HEAD@{X} to go to that last commit. If you haven't done anything after deleting it, X is 1.

  3. Use git checkout -b master to create a master branch on that commit.

Optionally you want to set up tracking if you're using a remote repository (e.g. origin):

git branch --track master origin/master

Upvotes: 1

Related Questions