Skip to content

Instantly share code, notes, and snippets.

@daneden
Created June 12, 2020 13:06
#!/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