DEV Community

Nicky Meuleman
Nicky Meuleman

Posted on • Originally published at nickymeuleman.netlify.com on

How to unfork a repo on GitHub

TL;DR: 2 steps: Rename the repository. Import the renamed repository under the original name.

Sometimes a repository on GitHub started off as a fork.

You now want to break that connection.

Forks on GitHub come with a few special behaviours, like the issues tab not being enabled by default.

no issue tab

1. Rename your repository on GitHub

Go to the repository on GitHub, find the Settings page and rename your repository. (Don't worry, you'll get to keep the original name.)

rename your repository on Github

This freshly renamed repository is still marked as a fork!

repository marked as a fork

2. Import the repository

GitHub provides a way to import repositories.

import repository feature

Grab the link to clone the repository you just renamed and enter it.

NOTE: Provide the https link, the SSH one won't work

For the name, enter the original name of your repository.

import screen

After a while the "new" repository will be ready.
If there is an e-mail address linked to that GitHub account, an e-mail will also notify you of success.

Successfully imported the repository

Enjoy your unforked repository

unforked repository

The git history is still there. 👍

The locally cloned project does not have to be touched.

Pushing a change should work without intervention, since the remote url is the same as before.

Since this is technically a brand new repository, some things (specific to the GitHub web UI) were lost.
For example: pull requests, a description, the provided website url.

an empty header for a description and website

Top comments (3)

Collapse
 
jsn1nj4 profile image
Elliot Derhay

I have seen people create a copy that wasn't a fork before. I have a question though: if the project is going to have the exact same name, what are some reasons to break the "fork" connection between your fork and the original?

Collapse
 
nickymeuleman profile image
Nicky Meuleman • Edited
  • If the connection as fork no longer makes sense.
    The example used in this post started as a fork from an example repo.
    It was great to get started, but the connection no longer makes sense. No pull requests from my fork to that original example repository would be logical.

  • It can make extra contributions harder.
    If anyone wanted to fork, (and contribute to) gatsby-theme-nicky-blog while it was still marked as a fork of that example repo. GitHub wouldn't let them do that if they forked that example repo as well.

Collapse
 
codewitgabi profile image
codewitgabi

I did this and my codes were not imported into the new repo