Как убрать fork в github
In the process of developing this blog on Github Pages, I’ve used and modified a Jekyll theme called Kiko Plus. That theme itself is a fork of the original Kiko theme, which is no longer maintained.
After forking Kiko Plus and making changes, I noticed that my fork still refers to the parent repo on Github. Things like pull requests, issues, etc will still be reflected against the parent repo, so I wanted to make a clean split. I also want to be able to pull request/merge my branches to my own repo instead of the parent.
This technique is called mirroring, and Github has documentation for it: Duplicating a repository
In addition, it would be nice to clean up all the old commits but keep my newer ones — to do that, I’ll rebase and squash the old ones into a single commit.
Mirror Forked Repo
The first step is to make a local bare clone of the existing Github Pages repo, and cd into it:
Next, create a new temporary repository in Github for the mirror: new-devedge.github.io
Push the bare clone up to the new temporary repository:
Delete the forked repository from Github ( devedge.github.io ), and rename the temporary repository to its name ( new-devedge.github.io -> devedge.github.io )
Now the fork is an independent mirror!
Rebase Commits
There’s a lot of work done in the previous repo that I would like to compress down to one commit. To do this, let’s first rebase the entire repo history up to the first commit:
The interactive rebasing tool will open to your preferred terminal editor:
Reword the first commit, and prefix the remaining with fixup so they get squashed together without their commit messages.
After saving the changes, the rebase is ready to push. Force the push to ovewrite the remote origin:
Deleting a repository
You can delete any repository or fork if you’re either an organization owner or have admin permissions for the repository or fork. Deleting a forked repository does not delete the upstream repository.
Only members with owner privileges for an organization or admin privileges for a repository can delete an organization repository. If Allow members to delete or transfer repositories for this organization has been disabled, only organization owners can delete organization repositories. For more information, see «Repository roles for an organization.»
Deleting a public repository will not delete any forks of the repository.
Warnings:
- Deleting a repository will permanently delete release attachments and team permissions. This action cannot be undone.
- Deleting a private repository will delete all forks of the repository.
Some deleted repositories can be restored within 90 days of deletion. For more information, see «Restoring a deleted repository.»
On GitHub.com, navigate to the main page of the repository.
Under your repository name, click
Settings. If you cannot see the «Settings» tab, select the
dropdown menu, then click Settings.
In the «Danger Zone» section, click Delete this repository.
Read the warnings.
To verify that you’re deleting the correct repository, in the text box, type the name of the repository you want to delete.
Click I understand the consequences, delete this repository.
Help and support
Help us make these docs great!
All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.
How to unfork a GitHub repository (2023 official method)
Who doesn’t love GitHub? And who hasn’t their GitHub account cluttered with forked repositories of projects you’ve long stopped contributing too? Do you want to clean up your account and unfork outdated repositories? Learn how to unfork a GitHub repo the correct way.
How to unfork a repository
Unfortunately, GitHub doesn’t offer an Unfork repository button. Unforking is a manual process which needs to be done by a GitHub employee. But because of the large demand for unforking or detaching repositories, GitHub has built a special chatbot to enter your request. Luckily, the GitHub team performs unfork requests very fast, so it’s very likely that it takes only a few minutes to half an hour.
How to detach/extract a GitHub repository
Go to support.github.com/request (or go to GitHub.com and click Contact GitHub in the footer).
Click Attach, detach or reroute forks.
In the Subject field, typ ‘Unfork’. A blue banner should appear with ‘Our virtual assistant can help’. Click the banner.
A chat should appear on screen with the Virtual Assistant. Paste the URL of the repository.
_Note: make sure to paste the URL to the forked repository, so not the original repository. It should look like github.com/username/forked-repo-name.
Specify what should be done with Child forks:
If username/forked-repo-name has child forks, what should we do with these?
Commonly you’ll want to bring the child forks along with you when detaching your fork from the upstream repository.
- Bring the child forks with the repository
- Leave the child forks behind
Select one of the options and send the form.
Within a few minutes to half an hour you should get a confirmation in your e-mail.
Now you’ve successfully unforked a GitHub repository! The repository stays in your account as a personal repository, without ties to the original repository.
Using the GitHub virtual assistant to unfork a GitHub repo.
The GitHub assistant to unfork a repository.
What is GitHub forking?
GitHub is a great tool for developing software. Millions of developers and companies build, ship and maintain their software on GitHub. If you’ve used GitHub for a while, you may find yourself wanting to contribute to someone else’s project. Or you would like to use an other project as a starting point for your own project. GitHub makes this really easy by allowing you to fork other people’s projects. But what about unforking?
If your project is finished or if you’ve made your contribution, the forked repository will still be shown in your account as ‘forked from X’.
Published by Ralph J. Smit on 02 February 2021 in Github. Last updated on 22 February 2023.
Deleting unwanted forks from GitHub
At some point in my life I thought it would be a good idea to start forking git repos in GitHub instead of just starring them. I guess it started with a fear the repos might not exist in some point in the future and that I would like to have a copy for reference. But really how many times do I ever go back to stored bookmarks, or saved copies of things. Guess I am a digital hoarder.
Deleting forks you no longer want from GitHub is a real PITA.
Setup a GitHub token to be used by delete-github-forks
Go to https://github.com/settings/tokens/new and create a new token. I used delete-github-forks as the Note field.
Set the public_repo and delete_repo permissions for the token.
Generate the token and then make sure you copy the token and store it securely (I use 1Password).
Configure delete-github-forks
Configure the credentials to be used against GitHub.
Specify your GitHub username and the token you generated earlier.
Fetch the list of forks
This creates a file called repos.json and you need to remove all the forks that you actually want to keep.
It is worth reiterating from the repo’s documentation:
The repositories that remain inside repos.json will be deleted on the next command. It is an irreversible operation. Use with great caution!.
See the last section on how I did a quick verification on each fork to see if I wanted to keep it or not.
Deleting the unwanted forks
See the warning above. Make sure you only keep the forks in repos.json that you actually want to delete.
Delete the forks.
Amazing in less than 2 seconds this deleted 68 forks I was no longer needing!
Miscellaneous
I wanted to visit the GitHub page for each of the forks. So I thought I would open all the tabs in bulk from the command line
Breakdown
Replace “andrejacobs with: open “https://github.com/andrejacobs
This is by far not the most optimized or best way but it did open 50+ tabs in my browser.
The process was pretty simple. I check what the fork is about and even visit the repo it was forked from to see if it still exists etc. and then made an informed decision if I wanted to keep my fork or not. Also now was a good time to start starring repos I cared about and NOT fork them.