18

Following scenario:

I forked an open source repository (GitHub -> project -> Fork). Then I cloned my project copy locally, made some changes in the master branch, commited them, and pushed to my repository:

$ git clone git@github.com-myusername:myusername/originalprojectname.git
... changes ...
$ cd originalprojectname
$ git add path/to/changed/file.php
$ git commit -m "..."
$ push

After it I started a pull request on GitHub. It has been marked as "Good to merge" and added to Milestone: x.y.z.

Where is the changed code staying? Only in my repo or also something else? The backgroud is: I would like to delete my repository. So, finally my question: If I delete my repository on GitHub, are the changes still available then for the original project or should I wait for the release x.y.z?

automatix
  • 14,018
  • 26
  • 105
  • 230

1 Answers1

20

Yes, the code will still be there after you delete your repo. As soon as you submit your pull-request, Github internally adds that branch to the target repo (it creates a branch in a non-default namespace, so you usually don't see those).

Since PRs cannot usually be deleted, those branches will exist in the target repo indefinitely.

To answer your other question: The code will reside in both your fork and the target repo (originally, at least, unless you delete your fork).

Nevik Rehnel
  • 49,633
  • 6
  • 60
  • 50
  • 4
    FYI, [this talk by Zach Holman](http://zachholman.com/talk/more-git-and-github-secrets/) (GitHub employee) confirms that "GitHub stores all pull requests in your repository […] even if the fork is deleted". – Dennis Sep 05 '13 at 19:58
  • 3
    when I refork the deleted repo from upstream, can I continue update the previous PR thread? – luthfianto Jan 13 '16 at 09:39