Post

Detaching a Github Fork

Detaching a Github Fork

About Detaching Forks

To convert your fork into a standalone repository, start by cloning the fork. Use the cloned repository to create a new, independent repository, and then delete the original fork. This approach is beneficial when you want to diverge the work in a different direction or maintain separate versions.

Please note that the new repository will no longer automatically sync with changes from the original repository.

Detaching a Fork

You can delete a fork and recreate the same repository with the option of having it private.

1. Open Git Bash

2. Create a bare clone of your forked repository on Github.

1
git clone --bare -b master --single-branch --no-tags https://github.com/<your-username>/temp-repo.git

3. You can now delete the forked repository on Github. For more information, see Deleting a repository.

Deleting a fork will permanently delete any associated pull requests and configurations. This action cannot be undone.

4. From your account create a new repository with the same name. For more information, see Creating a new repository.

5. Mirror-push the repository back to the same remote URL.

1
git --git-dir temp-fork.git push --mirror https://github.com/<your-username>/<your-repo-name>.git

6. Remove temporary local clone you created earlier in the initial step.

1
rm -rf temp-repo.git
This post is licensed under CC BY 4.0 by the author.

Trending Tags