Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reattach a "Detached" fork in Github?

Tags:

git

github

I'm wondering if there is anyway to reattach a "detached" repository in GitHub?

Order of events:

  1. Forked a private repository from an organization I belong to
  2. Parent, private repository went public
  3. I made my forked repository public as well (or get billed)
  4. Now when I was hoping to submit a pull request and merge some changes, I noticed that my fork is "detached" from the parent repository (see this explanation and confirmation as to why)

Is there any hope of "reattaching" this fork? Or do I rename my repository, fork again, and copy over code?

Any suggestions welcome.

like image 306
ghukill Avatar asked Mar 25 '16 18:03

ghukill


People also ask

What happens to a forked repository if the original is deleted?

If a team's access to a private repository is revoked or a team with access to a private repository is deleted, and team members do not have access to the repository through another team, private forks of the repository will be deleted.

How do I recover a deleted fork?

If you want to restore a repository that was part of a fork network that is not currently empty, you can contact GitHub Support. It can take up to an hour after a repository is deleted before that repository is available for restoration. Restoring a repository will not restore release attachments or team permissions.

What happens if I delete a forked repository in GitHub?

Warnings: Deleting a repository will permanently delete release attachments and team permissions. This action cannot be undone. Deleting a private repository will delete all forks of the repository.


2 Answers

The answer to delete the repository is destructive and will lose any progress and comments in open pull requests.

The best solution is to contact GitHub via a support message detailing that you have changed a repository from private to public and the forks are in a detached state. GitHub will do the change for you, in my case within 30mins.

Support contact form: Github support contact page

like image 152
Aiky30 Avatar answered Oct 16 '22 19:10

Aiky30


Thanks to @saeedgnu for the elegant and perfect suggestion. Solution was to:

  1. Make sure to pull and update local git repository from personal, detached fork GitHub repository
  2. Delete personal, detached fork GitHub repo
  3. Re-fork repository on GitHub
  4. The key: the local git repository is still pointing at the correct GitHub repo. It has the current code from your now-deleted, detached GitHub fork, so you can push changes (and continue to submit pull requests) like nothing ever happened!

Phew. Crisis averted.

like image 21
ghukill Avatar answered Oct 16 '22 19:10

ghukill