{"id":13432814,"url":"https://github.com/denis-sokolov/remove-github-forks","last_synced_at":"2025-04-05T14:10:02.621Z","repository":{"id":23696285,"uuid":"27068298","full_name":"denis-sokolov/remove-github-forks","owner":"denis-sokolov","description":"Clean your useless GitHub forks","archived":false,"fork":false,"pushed_at":"2022-10-31T10:28:57.000Z","size":402,"stargazers_count":281,"open_issues_count":2,"forks_count":21,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-19T05:18:52.719Z","etag":null,"topics":["forks","github","useless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denis-sokolov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-24T09:04:11.000Z","updated_at":"2024-08-08T15:18:38.000Z","dependencies_parsed_at":"2022-08-22T04:10:46.502Z","dependency_job_id":null,"html_url":"https://github.com/denis-sokolov/remove-github-forks","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-sokolov%2Fremove-github-forks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-sokolov%2Fremove-github-forks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-sokolov%2Fremove-github-forks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-sokolov%2Fremove-github-forks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denis-sokolov","download_url":"https://codeload.github.com/denis-sokolov/remove-github-forks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345856,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forks","github","useless"],"created_at":"2024-07-31T02:01:16.997Z","updated_at":"2025-04-05T14:10:02.601Z","avatar_url":"https://github.com/denis-sokolov.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Clean your useless GitHub forks\n\n[![npm](https://img.shields.io/npm/v/remove-github-forks.svg)](https://www.npmjs.com/package/remove-github-forks)\n[![npm](https://img.shields.io/npm/dt/remove-github-forks.svg)](https://www.npmjs.com/package/remove-github-forks)\n[![Build Status](https://github.com/denis-sokolov/remove-github-forks/workflows/CI/badge.svg?branch=master\u0026event=push)](https://github.com/denis-sokolov/remove-github-forks/actions)\n\nIf you contribute to many projects on GitHub, your profile is full of temporary forks that are only useful while the pull request is open. After that there is no reason to keep the fork. This tool will delete all such forks. And if there’s any commits in the fork that have not yet been merged upstream, the fork will be kept, of course. For the extra peace of mind, the tool will ask you to confirm the forks it plans to delete.\n\nGitHub now suggests to delete the fork after deleting a PR branch, so this software is now less necessary. Still, depending on your workflow, you may benefit from mass-pruning of forks.\n\n## Usage\n\nTo allow the library access to a GitHub account, one needs an OAuth token.\n[Create a new token](https://github.com/settings/tokens/new) with permissions `public_repo`, `delete_repo`. (include `repo` as well if you want to allow access to private repositories), and pass it to the library.\n\n### Install\n\n```\n$ [sudo] npm install --global remove-github-forks\n```\n\n(Or run [with Docker](https://hub.docker.com/r/arska/remove-github-forks))\n\n### Run\n\n```\n$ remove-github-forks token\n? Will delete: user/repo, user/repo2 \u003cyes|no\u003e: yes\nDone!\n```\n\nWarning! Your shell will likely store your command history in a plain-text file such as `.bash_history`. As a quick workaround, consider adding a space in front of your command for it to not be stored:\n\n```\n$ \u003cspace\u003eremove-github-forks token\n```\n\nIf you want to do this often and are happy with saving the token in plain-text, add an alias to your `.bashrc`:\n\n```\nalias clean-github='remove-github-forks YOUR-TOKEN'\n```\n\n#### Options\n\n- `--debug` will output extended details in case of errors.\n- `--user \u003cuserOrOrganization\u003e` will only clean repositories for the user or organization provided, without touching repositories for organizations you are in.\n- `-y`, `--yes` will not ask for confirmation before deleting repositories. Useful for cron jobs!\n\n### API\n\nMain usage to delete useless forks:\n\n```javascript\nvar clean = require(\"remove-github-forks\");\nclean(token, function (err) {});\nclean(\n  token,\n  {\n    // If user is given, only forks belonging to this username\n    // (or organization) will be deleted.\n    user: \"my-username\",\n  },\n  function (err) {}\n);\n```\n\nAdvanced usage:\n\n```javascript\n// Get a list of repositories that are useless\n// repos is a list of {user, repo, url} objects\nclean.get(token, {\n  // Trigger when we can estimate the amount of work done\n  // info has fields:\n  //   countInspected: number of inspected forks\n  //   lastInspected: name of last inspected fork, can be empty at the start\n  //   totalToInspect: total count of forks to inspect\n  progress: function(info){}\n\n  // If user is given, only forks belonging to this username\n  // (or organization) will be returned.\n  user: 'my-username',\n\n  // If something in the process goes a little bit wrong in a non-destructive\n  // way, we will skip the problematic item and continue. Use this callback\n  // to know about such cases.\n  warnings: function(msg, err){}\n}, function(err, repos){});\n\n// Delete repositories\n// repos is a list of {user, repo} objects\nclean.remove(token, repos, function(err){});\n```\n\n## Alternatives\n\nI am not aware of many alternatives to this tool.\n\nOne is [github-clean-forks by caub](https://caub.github.io/github-clean-forks).\n\n## Credits\n\nThanks for everyone who has contributed, and in particular [@fregante](https://github.com/fregante) for reinvigorating a paused project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenis-sokolov%2Fremove-github-forks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenis-sokolov%2Fremove-github-forks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenis-sokolov%2Fremove-github-forks/lists"}