Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rshipp/default-branch
Change the default branch for all your GitHub repos at once.
https://github.com/rshipp/default-branch
default-branch github github-api
Last synced: about 1 month ago
JSON representation
Change the default branch for all your GitHub repos at once.
- Host: GitHub
- URL: https://github.com/rshipp/default-branch
- Owner: rshipp
- Created: 2020-06-15T00:02:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-06-15T00:10:39.000Z (over 4 years ago)
- Last Synced: 2024-12-22T11:48:28.587Z (about 1 month ago)
- Topics: default-branch, github, github-api
- Language: Python
- Homepage:
- Size: 1000 Bytes
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Bulk-change the default branch for all your GitHub repos at once, from `master` to `main` (or another new default you choose).
Usage:
pip3 install -r requirements.txt
python3 run.py GITHUB_OWNER GITHUB_TOKEN [NEW_DEFAULT_BRANCH=main]`GITHUB_OWNER` is your username, unless you want to change repos under an organization (in which case you should use the org name).
Get a token from [your account settings](https://github.com/settings/tokens). Make sure it has full repo permissions.
By default, the script ignores:
* Forks
* Archived repositories
* Repos where the default branch is already non-standard (e.g. `development`).
* Repos ending in `.github.io`, because GitHub Pages has hardcoded branch names.Side effects:
* Existing clones will need to be updated, with `git fetch && git checkout NEW_DEFAULT_BRANCH`.
* Open pull requests to the old branch will be closed.
* Branch protection rules, CIs, and other systems that exclicitly reference the old branch by name may need to be updated seperately.
* You may get @dependabot PRs on repos that haven't been updated recently and have outdated pinned dependencies.