Unfork a Github fork without deleting

GitGithub

Git Problem Overview


I would like to "unfork" a GitHub fork without deleting + recreating it. Is this possible?

My reason is that my project now has a completely different use to the source of the fork, and makes no sense to be showing number of commits ahead, or the pull request button (or at least, with such prominence). With hindsight, I think I would have just git cloned the original, rather than made a fork.

I would like to not delete my fork in order to keep the issues + history of pull requests made.

I am happy to keep the history of commits, it's just the removal of the fork status that I'm after.

Git Solutions


Solution 1 - Git

Na, na. Github is far more powerful than you think.

Undoubtedly, there's no way but make a bare copy of all of the codes. However, the copy procedure can be done by Github itself. So, no pain of mirroring the code with our own bandwidth.

Step by step:

  • Click the "+" on top right corner, select "Import repository"
  • Paste the old repo url (like https://github.com/user/repo) and enter a new name.
  • Click "Begin import"

Done. Github will even give you an email notification when copy'n'paste is done.

Tested to work against my own project. Good feature isn't it?

Solution 2 - Git

This method will create a new "unforked" repository while maintaining everything else (commit history, branches and tags).

How to "unfork" a project in four easy steps:

  1. git clone --bare https://github.com/{username}/{repository}
  2. Delete original repository in https://github.com/{username}/{repository}/settings.
  3. Create new repository with the name {repository} at https://github.com/new.
  4. cd {repository}.git and git push --mirror https://github.com/{username}/{repository}

And done!

Solution 3 - Git

I remember reading about this almost a year ago in one of GitHub's help pages. They mentioned to contact the GitHub staff explaining your situation. The staff will do the needful.


EDIT

After browsing through the GitHub pages list, I see that I was a bit off about the actual task. The page I remembered was Transferring a repository; in particular:

> If the transferred repository has any forks, then those forks are associated with the new repository after the transfer is complete. > Keep in mind that users who have forked your repository will need to > update their remote URLs to point to the new Git repository in order > to continue opening pull requests.


It is still worth it to contact the staff with your particular issue and ask them to separate your fork from the network.

Solution 4 - Git

I found the following in the official github documentation:

> To detach the fork and turn it into a standalone repository on GitHub, contact GitHub Support. If the fork has forks of its own, let support know if the forks should move with your repository into a new network or remain in the current network. For more information, see "About forks."

from https://help.github.com/articles/why-are-my-contributions-not-showing-up-on-my-profile/#commit-was-made-in-a-fork

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMichal CharemzaView Question on Stackoverflow
Solution 1 - GitttimasdfView Answer on Stackoverflow
Solution 2 - GitTiago A.View Answer on Stackoverflow
Solution 3 - Githjpotter92View Answer on Stackoverflow
Solution 4 - GitdpoetzschView Answer on Stackoverflow