Skip to content

PurpleBooth/change-github-default-branch.sh

Repository files navigation

change-github-default-branch.sh

$ curl --silent --location --output - \
    https://raw.githubusercontent.com/PurpleBooth/change-github-default-branch.sh/main/change-github-default-branch.sh | \
    bash -s --
USAGE: curl --silent --location --output - https://raw.githubusercontent.com/PurpleBooth/change-github-default-branch.sh/main/change-github-default-branch.sh | bash -s -- [-t GITHUB_TOKEN] [-d DEFAULT_BRANCH_NAME] USER/REPO

OPTIONS
  -t          Default: GITHUB_TOKEN environment variable     The GitHub token to use
  -d          Default: main                                  The new branch
ARGS
  USER/REPO   Required  A github repository, for example purplebooth/readable-name-generator

You can create a GitHub token (it needs at least repo:public_repo, or repo on private repositores) from https://github.com/settings/tokens/new

A more full examle:

curl --silent --location --output - https://raw.githubusercontent.com/PurpleBooth/change-github-default-branch.sh/main/change-github-default-branch.sh | \
    bash -s -- \
    -t YOURGITHUBTOKENAAAAAA -d primary example/repo

Alternatively, to avoid curling to bash you can run

curl -LO https://raw.githubusercontent.com/PurpleBooth/change-github-default-branch.sh/main/change-github-default-branch.sh
chmod +x change-github-default-branch.sh
./change-github-default-branch.sh -t YOURGITHUBTOKENAAAAAA -d primary example/repo

Does not delete the old default branch, or change where pull requests are based from, incase something breaks.

Dependencies

  • Curl
  • Python2 or Python3

Thanks

About

Quickly change your GitHub repositories default branch something else

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages