GitHub – Main Repository After Original is Deleted

github

For instance, there is a repo called foo.

There are three forks of it called foo-bar, foo-baz and foo-baq which were created sequentially.

foo is updated quite frequently. Forks are more or less outdated, e.g., foo-baq is the freshest one (but not as fresh as foo) and foo-bar is the oldest one.

What happens when the owner of foo deletes it? Which of the forks is chosen as the main repo (i.e. shown as "forked from" in two other forks)?

Best Answer

Provided that the main repository is public, the oldest fork is selected to become the parent:

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.

Source: GitHub Help: What happens to forks when a repository deleted or changes visibility?

Update #1: Doing some rudimentary testing (creating multiple forks and then deleting the parent), it appears that the oldest fork becomes the parent.

Update #2: I emailed the support team, and this is the reply I received:

Hi ---,

Thanks for getting in touch. That's correct, the oldest fork is promoted to be the new root repo. However, they original root repo owner can contact us beforehand to switch the root to whichever repo they'd like.

Let us know if you have any other questions.

Cheers, Jamie