4

I made a PR on a repository, deleted my fork and I can't access my PR branch anymore. It says unknown repository at the top now.

How do I get back to a PR branch in a deleted fork?

I tried to make a new fork, clone it and do git checkout nameofbranchfrompullrequest, but all the changes disappeared.

Igor Popov
  • 9,795
  • 7
  • 55
  • 68
r00ster
  • 85
  • 2
  • 9

1 Answers1

5

If I understood correctly:

  1. you forked a repo on GitHub
  2. you made some changes in the fork
  3. you submitted a PR to the original repo from your fork
  4. you deleted the fork
  5. now you want to recover the changes you made on the GitHub fork

Once you delete a repo from GitHub you have to email support@github.com as soon as possible when this happens unless you have your forked repo still cloned somewhere on your computer.

Igor Popov
  • 9,795
  • 7
  • 55
  • 68
  • Ah I found a local clone. Do you know how I could upload this cloen so its my fork on my account? Theres the branch of the pull request in the local clone. – r00ster Jun 18 '18 at 17:49
  • 4
    Create a new repo on GitHub and add that new repo as a remote `origin` to the one you have locally (GitHub gives you instructions after creating the repo). After that push from local to GitHub (`git push`). – Igor Popov Jun 18 '18 at 18:42
  • 1
    I just tried it, and I can of course push to my fork as if it's been reinstated, but it doesn't actually push to the same PR as the original even if the branch name is the same. I can open a new pull request (and mark the old one as superseded). – webninja Aug 02 '21 at 04:31
  • 2
    Hovering over the greyed out branch name from my old fork displays the message: **"This repository has been deleted"**. It looks like there's an internal reference to the fork that is different for the newly created one. – webninja Aug 02 '21 at 05:01