Skip to content

Instantly share code, notes, and snippets.

@butchhoward
Last active September 22, 2020 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save butchhoward/599743312208cabada9a89d622931d8a to your computer and use it in GitHub Desktop.
Save butchhoward/599743312208cabada9a89d622931d8a to your computer and use it in GitHub Desktop.
git branch rename master to trunk
# 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