Search code examples
githubforkgit-submodules

De-forking a Github repo


Is it possible to 'de-fork' a GitHub repo? The situation is as follows. I have forked a repo and then added some scripts to it. But then I realized it might be more sensible to use the original repo as a git submodule. So I want to refactor my now-fork in such a way that it is no longer a fork, but uses the original repo as a submodule.

I believe I could simply remove all files forked from the original repo (leaving only my own added scripts), add the original as a submodule and commit. But then I guess it would still be flagged as a fork on github.

What is the best practice here?


Solution

  • One way to do that would be to

    • Click Import repository enter image description here
    • Then linking to the repository you forked (your link and not the original repository).
    • Add new repository details and click Begin Import
    • Delete the forked repository once import finishes

    I hope this helps.

    Edit

    In order to preserve everything, you will have to contact GitHub support, as mentioned on this page. Doing so will keep everything you want

    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.