0

I have deleted the remote master branch by mistake and now I don't have local code and i am getting out of my mind because all the team code was in that branch. Please help me i am stuck very bad.

Ali Tahir
  • 21
  • 2
  • 2
    What exactly did you do to delete the master branch? – mkrieger1 Apr 20 '21 at 11:06
  • 3
    Step 1: Don't Panic, the code is almost certainly recoverable. Step 2: Click [edit] and explain exactly what you did, and someone can tell you the easiest way to recover from it. Step 3: Set up [branch protection](https://docs.github.com/en/github/administering-a-repository/about-protected-branches) in Github so that this doesn't happen again. – IMSoP Apr 20 '21 at 11:11
  • If anyone on your team has a sandbox cloned, including yourself, have a look at https://stackoverflow.com/a/3640806/3216427 to recreate the remote branch from your local (possibly deleted) one. – joanis Apr 20 '21 at 20:00
  • Does this answer to your question? https://stackoverflow.com/questions/3640764/can-i-recover-a-branch-after-its-deletion-in-git – alphaX64 Apr 21 '21 at 10:43

1 Answers1

2

In this case, I think the only thing you can do is to ask around your teammates, if someone has the local branch. From there, you can restore / push it to wherever your remote branch was originally.

Vendel Serke
  • 135
  • 11