What happens to the forks when deleting the original repository?

Viewed 16660

I want to know what happens if the original repository is deleted when there are different forks. Do the forks stay on GitHub, or are the forks also deleted?

4 Answers

It depends whether the original and the fork are public or private, according to GitHub's documentation:

  • Deleting a private repository will delete all of its forks.
  • Deleting a public repository will not delete its forks.

More detail on this page:

Deleting a private repository

When you delete a private repository, all of its private forks are also deleted.

Deleting a public repository

When you delete a public repository, one of the existing public forks is chosen to be the new parent repository. All other repositories are forked off of this new parent and subsequent pull requests go to this new parent.

  1. If original private repo deleted: all of its forks will be deleted.

  2. If original public repo deleted: its forks will not be deleted.

  3. If public repo is converted to private, and deleted the original: forked repo will not be deleted.

    a public repository's forks will remain public in their own separate repository network even after the parent repository is made private.

So, If you fork from a public repo, forked repo will not be deleted. If you fork from private repo, forked repo will be deleted.

Source: https://help.github.com/en/articles/what-happens-to-forks-when-a-repository-is-deleted-or-changes-visibility

Just to add further information: on Bitbucket a forked repository will not be deleted, when the parent is deleted. Found here:

If the original repository is deleted, the fork remains.

This answer is based in the documentation. Once you fork a...

  1. ... public repo, you'll always have access to the respective files and folders (no matter if the repo is made private later on).
  2. ... private repo, all of its private forks are also deleted.
Related