Skip to content

Instantly share code, notes, and snippets.

@daneden
Created June 12, 2020 13:06
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daneden/c55160e7997318f23dc4264d21919fd9 to your computer and use it in GitHub Desktop.
Save daneden/c55160e7997318f23dc4264d21919fd9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Checkout master branch
git checkout master
# Rename "master" to "main"
git branch -m master main
# Unset the current upstream branch
git branch --unset-upstream
# Publish the "main" branch as upstream
git push origin -u main
# Delete the "master" branch from origin
# Note that this will cause an error from GitHub unless you go
# to the repo settings and change the default branch to "main"
git push origin --delete master
@tarngerine
Copy link

ohyeeeeeeeeeeeeeeeee thx u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment