158

How can I un-fork a GitHub repository?

I have never seen unfork option - is it possible to do that?

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Mike Tavish
  • 1,787
  • 2
  • 11
  • 17
  • I think what you can do is either submit a pull request to merge the fork, or delete the forked repository – EpicPandaForce Aug 08 '16 at 14:05
  • 8
    It's too easy to fork on Github. I keep clicking it by mistake when I just want to see what forks there already are. – mwfearnley Sep 14 '17 at 12:38
  • 1
    Possible duplicate of [GitHub: make fork an "own project"](https://stackoverflow.com/questions/18390249/github-make-fork-an-own-project) – 0 _ Oct 20 '17 at 13:07
  • Possible duplicate of [Unfork a Github fork without deleting](https://stackoverflow.com/questions/29326767/unfork-a-github-fork-without-deleting) – ben rudgers Nov 15 '17 at 01:15
  • 1
    Possible duplicate of [Delete forked repo from GitHub](https://stackoverflow.com/questions/11302639/delete-forked-repo-from-github) – Val Jan 28 '18 at 12:44
  • Yeah, so many 'forks' are simply a result of an accidental click. – 9ilsdx 9rvj 0lo Nov 26 '21 at 13:09

7 Answers7

159

Update: There's now an automated solution

See https://stackoverflow.com/a/66470086/151312

Original Post

As of now Github doesn't have an unfork option, so the only solution is to delete the forked repo.

Warning: The following solution will delete your cloned repo. If you want unfork without your repo is being deleted try this https://stackoverflow.com/a/41486339/6335029

Step 1: Goto Settings of Repo you want to unfork

Step 2: Click Delete this Repository enter image description here

Step 3: Enter your name / Repo name

Step 4: click "I understand the consequences, delete this repository" button

enter image description here

coolaj86
  • 74,004
  • 20
  • 105
  • 125
Naveen DA
  • 4,148
  • 4
  • 38
  • 57
  • 47
    This will simply delete the repository. If you want to "unfork" the repository without deleting it, try this answer: http://stackoverflow.com/a/41486339/2546416 – Tiago A. Jan 05 '17 at 13:47
  • 10
    Yeah, this deletes the repo. Don't do this! – mikecousins Jun 13 '18 at 22:24
  • 3
    This is an answer to a totally different question. It should not be marked as the solution. – Michael Jun 06 '19 at 22:14
  • @Michael, you never find the unfork option in GitHub, so if you want unfork a repo you should delete it, that's why it marked as the solution. – Naveen DA Jun 07 '19 at 07:57
  • @NaveenDA The linked answer is the correct one. Then you proceed to explain how to delete a repo. Deleting the repo is not the answer. If the question asked was "how do I delete a repo?", this would be the answer. Add the other steps, and then I'm on board. – Michael Jun 08 '19 at 20:02
  • @Michael even the linked answer is also to delete the repo, but they don't give steps to delete, so I decided to give that steps( FYI: 62 people likes this answer) – Naveen DA Jun 09 '19 at 12:40
  • 1
    @NaveenDA Check out Tiago's response – Michael Jun 09 '19 at 20:27
  • @Michael that also delete your repo "Delete original repository in https://github.com/{username}/{repository}/settings" – Naveen DA Jun 10 '19 at 13:25
  • @NaveenDA It does, but then it creates the new unforked repo which is what's missing here. – Michael Jun 10 '19 at 19:13
  • @Michael, Yeah but how can you say "it is a totally different answer" when you delete the repo which also meant you unfork the repo. – Naveen DA Jun 10 '19 at 19:19
  • @NaveenDA You are missing steps in unforking a repo. All you showed is how to delete a repo. As mikecousins accurately stated, if all you did was follow your directions, you would no longer have your repo! That's why you need the rest of the steps to make this a good answer so someone doesn't just lose their work. – Michael Jun 10 '19 at 19:39
  • That's why I provide Warning at the beginning. – Naveen DA Jun 10 '19 at 19:58
  • If you want to retain anything (or everything) of your repo, simply contact GitHub support about detaching your fork. They will do so no questions asked since it is a common request. – Appleshell Oct 16 '19 at 15:59
  • @NaveenDA Step one should be "Clone or copy your repo". You've done a really good job of drawing peoples eyes to the clear and simple instructions, but are putting novice users at risk by placing the warning *outside* of those instructions in a block quote. This is terrible UX. I wonder how many people have had to pray afterwards that they had a clone at all, nevermind a recent one. Or have had to go hunt down a clone from a colleague. What if a user has never cloned the repo at all, and only made edits of the fork in github? Work gone. Poof. – Dale C. Anderson Jul 29 '20 at 00:13
  • Okay I will add – Naveen DA Jul 29 '20 at 02:48
  • @MuhammetAliAsan All the answer are in creative commons license in Stackoverflow. Still, we can create a compliant on StackOverflow meta – Naveen DA Oct 12 '20 at 09:18
  • Forking creates a copy of repository. Undoing a fork means deleting that copy. So simple is that, a pity that option to revert false click is so hidden. I don't understand why so many folks doesn't understand word 'undo' on purpose. +1 for great answer. – 9ilsdx 9rvj 0lo Nov 26 '21 at 13:09
44

GitHub support can do this for you.

  1. Go to this link https://support.github.com/contact?tags=rr-forks
  2. Type in "unfork"
  3. Let the virtual assistant help you

They completed the process for me within 1 minute after that.

bones225
  • 1,488
  • 2
  • 13
  • 33
22

Option 1: Rename, import, delete

  1. Rename your old fork (e.g. repo.old)

  2. Import your old fork as a new repo (Note: provide the https:// or git:// URI of the old fork)

  3. Delete / archive the old fork

Note: the "import" option is an option when creating stuff:

"Import repository"

Option 2: Clone, delete, create, push

  1. Back up your repo! E.g. git clone to your local file system.
  2. Delete the original repo from GitHub (See the other answer...)
  3. Create a new repo with the same name
  4. Push your local backup to the new GitHub repo

I recommend option 1.

Whatever you do, back up your work! Especially if you follow the other answer, which just tells you to delete your repo...

william_grisaitis
  • 5,170
  • 3
  • 33
  • 40
  • Honestly I though they had the unfork functionality....... but yeah, this is a valid more verbose way of doing so :) – aemonge Mar 14 '19 at 11:09
6

Unfork without deleting the repository

  1. Go to this link https://support.github.com/request?q=unfork
  2. Click on "Our virtual assistant can help with detaching/unforking a repository"
    screenshot
  3. Click Detach screenshot
  4. It will ask for the Repository link
  5. Done.
Vitim.us
  • 20,746
  • 15
  • 92
  • 109
1

There isn't a way to do it via the web portal (without cloning/deleting the repo as described in other responses). I put in a request to GitHub support, asking them to convert the repository to 'normal mode', and they did it within five minutes.

Luke
  • 11
  • 1
0

You can always send in a ticket and have GH support detach it from the fork network for you. That way you keep the followers, issues, etc.

  • Are you sure GH provides this action as a service in support actions? – nilsandrey Nov 25 '20 at 06:44
  • I'm not exactly sure what you're asking. Can you file a ticket and request this? Yes, as other people have confirmed. You may need permission from the root owner. – user14702727 Dec 18 '20 at 23:55
0

It's possible, follow these steps:

1- First go to the parent project anf change it's visibility 2- Then do same with the child project

3- Then revert all repositories to thein initial state of visibility.

This worked for me. I hope same for you.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 22 '22 at 11:20