Last active
September 22, 2020 21:14
-
-
Save butchhoward/599743312208cabada9a89d622931d8a to your computer and use it in GitHub Desktop.
git branch rename master to trunk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# on a local clone when the remote has NOT been updated to the new branch name yet | |
git checkout master | |
git branch -m master trunk | |
git fetch | |
git branch --unset-upstream | |
git branch -u origin trunk | |
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/trunk | |
# change the DEFAULT BRANCH on GitHub to trunk before pushing or it will reject the push | |
git push origin --delete master | |
# on a local clone after the remote repo has been changed | |
git fetch --all | |
git checkout trunk | |
git remote set-head origin trunk | |
git remote prune origin | |
# to start a new repository out with only trunk | |
# simply do the first checkout to create trunk BEFORE committing anything | |
# only branches with commits are created, so master will never exist | |
git init | |
git checkout -b trunk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment