Search code examples
gitgithubopen-sourcepull-request

Understanding pull requests on GitHub: What happens, when the requesting repository is deleted?


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 [email protected]: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?


Solution

  • 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).