1

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?

2
  • Don't think you can un-flag that. You'll have to create a new repository. Commented Jan 16, 2018 at 18:48
  • Does this answer your question? Delete fork dependency of a GitHub repository Commented Sep 8, 2022 at 8:18

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

No, I don't have problems with 'importing' or submodules. I also want to 'preserve commit continuity' of my repo so other users who have already cloned my now-fork don't have many problems. Your answer basically is 'Throw away your repo and create a new one'. That is not what I want.
I did contact then and it really seems it is the only way. Thank you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.