The default git/GitHub branch name is oppressive terminology (more info). It is easy to change the branch name for a single repository or for new repositories. This script makes it easy to rename your default branch on GitHub repositories in bulk.
Usage
Installation
To install, run
python -m pip install rename-github-default-branch
Then, create a GitHub.com personal access token with the repo permission scope and set the environment variable:
export RENAME_GITHUB_TOKEN=YOUR_PERSONAL_ACCESS_TOKEN
Renaming branches on GitHub
Then to rename the default branch to main for a specific repository (you must have write access):
rename-github-default-branch -r dfm/rename-github-default-branch -t main
Or for all the repos that you own (excluding forks):
rename-github-default-branch -t main
You can also provide regular expressions to match against the repository name. For example:
rename-github-default-branch -t main -p "dfm/*" -p "exoplanet-dev/*"
Updating local branches
To update your local repository, you can run the following:
git fetch origin main
git checkout -b main origin/main
git branch -D master
where main is the name of the new default branch and origin is the name of the git remote.
Metadata
Release files for rename-github-default-branch 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rename_github_default_branch-0.0.3.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rename_github_default_branch-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / rename_github_default_branch-0.0.3.tar.gz
| Download URL | rename_github_default_branch-0.0.3.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61bdf9d5085e7c636eebc6d30d647f1015a64140dc3b8b6085a66bbaff01c049
|
|
BLAKE2b-256 checksum How to use checksums |
fc438c75eb5a13a0f68ee2ebd2f1818d700d7b8989d8bf32574695909e58025a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / rename_github_default_branch-0.0.3-py3-none-any.whl
| Download URL | rename_github_default_branch-0.0.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
afce3eb0304bcd2172fd9df5085c620118634d6f1fbda0feae4f7cb2f788ad5c
|
|
BLAKE2b-256 checksum How to use checksums |
c1f7989b678c737e26e31347a79587ba39c15a07cb853890162de2398eae9ad2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|