{"id":17190983,"url":"https://github.com/dfm/rename-github-default-branch","last_synced_at":"2025-10-08T15:04:06.724Z","repository":{"id":54103139,"uuid":"271824115","full_name":"dfm/rename-github-default-branch","owner":"dfm","description":"A Python script for bulk renaming the default branch of your GitHub repositories using the API","archived":false,"fork":false,"pushed_at":"2021-03-09T10:57:47.000Z","size":25,"stargazers_count":47,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T19:57:52.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dfm.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-06-12T14:57:48.000Z","updated_at":"2025-03-22T08:14:00.000Z","dependencies_parsed_at":"2022-08-13T06:50:22.229Z","dependency_job_id":null,"html_url":"https://github.com/dfm/rename-github-default-branch","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dfm/rename-github-default-branch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Frename-github-default-branch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Frename-github-default-branch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Frename-github-default-branch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Frename-github-default-branch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dfm","download_url":"https://codeload.github.com/dfm/rename-github-default-branch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Frename-github-default-branch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278963821,"owners_count":26076544,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-15T01:24:33.304Z","updated_at":"2025-10-08T15:04:06.704Z","avatar_url":"https://github.com/dfm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"The default git/GitHub branch name [is oppressive terminology](https://tools.ietf.org/id/draft-knodel-terminology-00.html#rfc.section.1.1) ([more info](https://mail.gnome.org/archives/desktop-devel-list/2019-May/msg00066.html)).\nIt is easy to change the branch name [for a single repository](https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx) or [for new repositories](https://leigh.net.au/writing/git-init-main/).\nThis script makes it easy to rename your default branch on GitHub repositories in bulk.\n\n## Usage\n\n### Installation\n\nTo install, run\n\n```bash\npython -m pip install rename-github-default-branch\n```\n\nThen, create a [GitHub.com personal access token](https://github.com/settings/tokens) with the `repo` permission scope and set the environment variable:\n\n```bash\nexport RENAME_GITHUB_TOKEN=YOUR_PERSONAL_ACCESS_TOKEN\n```\n\n### Renaming branches on GitHub\n\nThen to rename the default branch to `main` for a specific repository (you must have write access):\n\n```bash\nrename-github-default-branch -r dfm/rename-github-default-branch -t main\n```\n\nOr for all the repos that you own (excluding forks):\n\n```bash\nrename-github-default-branch -t main\n```\n\nYou can also provide regular expressions to match against the repository name. For example:\n\n```bash\nrename-github-default-branch -t main -p \"dfm/*\" -p \"exoplanet-dev/*\"\n```\n\n### Updating local branches\n\nTo update your local repository, you can run the following:\n\n```bash\ngit fetch origin main\ngit checkout -b main origin/main\ngit branch -D master\n```\n\nwhere `main` is the name of the new default branch and `origin` is the name of the git remote.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfm%2Frename-github-default-branch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfm%2Frename-github-default-branch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfm%2Frename-github-default-branch/lists"}