Skip to main content
  1. Posts/

Reliably Unforking a GitHub Repository Without Deletion and Reconstruction

·359 words·1 min· ·
Xianpeng Shen
Author
Xianpeng Shen
Table of Contents

Background
#

Developers, and even companies, may encounter the following problems:

  1. A repository was initially forked, and subsequently underwent significant modifications, diverging from the parent repository in both functionality and programming language.
  2. Because it’s a forked repository, every Pull Request defaults to the parent repository’s branch, leading to accidental PRs to the parent repository.
  3. Contributors have contributed to and used the forked repository, but their contributions and downstream usage are not visible, hindering project growth.

Due to these issues, developers may consider separating from the parent repository. However, GitHub currently doesn’t provide an Unfork/Detach function.

While deleting and recreating the project achieves separation, it results in the loss of crucial information such as Issues, Wikis, and Pull Requests.

Unforking is fundamentally different from leveraging Apache SkyWalking through a certain engine under a certain section. It’s more akin to the divergence of Hudson and Jenkins.

Solution
#

After investigation and testing, the most viable solution is to contact GitHub Support. The specific steps are as follows:

  1. Open this link: https://support.github.com/contact?tags=rr-forks
  2. Select your account or organization, then enter “unfork” in the Subject field. A virtual assistant will automatically appear; select the virtual assistant.
    View 1
  3. Follow the virtual assistant’s prompts and select the appropriate answers (partial screenshot below).
    View 2
  4. The conversation will be automatically transcribed. Send the request and wait for Support to process it (it shouldn’t take too long).
    View 3

It’s important to note that if your repository has been forked by others and you want to retain the fork history of your child repository after separating from the parent repository, you should select “Bring the child forks with the repository”.

Alternatively, using commands like git clone --bare and git push --mirror preserves the complete Git history, but not Issues, Wikis, or Pull Requests.

Hopefully, this helps those who need it.

References
#


Please indicate the author and source when reprinting this article. Do not use it for any commercial purposes. Welcome to follow the WeChat official account “DevOps攻城狮”

Related

Programmer's Self-Cultivation — Git Commit Message and Branch Creation Conventions
·1643 words·4 mins
This article introduces how to formulate and implement Git commit message and branch creation conventions to improve code quality and team collaboration efficiency.
Solving Two Git Clone Failure Issues on AIX
·878 words·5 mins
This article documents two issues encountered when using Jenkins for Git clone on AIX and their solutions, including dependent library loading failure and SSH authentication failure.
Resolving Git Large Repository Download Failures on AIX by Removing File Resource Limits
·368 words·2 mins
Resolving Git large repository download failures on AIX due to file size limits by modifying ulimit settings.
Branch Naming Convention
·205 words·1 min
This article introduces the conventional branch naming specification, including the purpose of branch names, key points, and basic rules for naming branches in Git. It also provides examples of branch prefixes and their meanings.
These settings in Bitbucket/GitHub recommends enable
·282 words·2 mins
Provides a list of recommended settings for Bitbucket and GitHub repositories, including enabling force push rejection, branch protection, tag management, merge checks, and commit message standards.
git sparse-checkout enable and disable
·127 words·1 min
This article explains how to enable and disable git sparse-checkout, including examples of how to configure sparse-checkout for specific directories and how to reset it.