Skip to content

Instantly share code, notes, and snippets.

@ZicklePop

ZicklePop/no-masters.md

Last active Sep 16, 2020
Embed
What would you like to do?
No more white supremacy in codebases.

Make Git always use main as default branch

Git 2.28.0

git config --global init.defaultBranch main

Pre-Git 2.28.0

mkdir -p ~/.config/git/templates/default
echo "ref: refs/heads/main" > ~/.config/git/templates/default/HEAD
git config --global init.templateDir '~/.config/git/templates/default'

Make main your main

git branch -m master main && git push -u origin main

Next, tell GitHub or whoever your new default is main. Then you can tell the remote repo to destroy the old branch:

git push origin :master

@ZicklePop

This comment has been minimized.

Copy link
Owner Author

@ZicklePop ZicklePop commented Sep 8, 2020

Shout out to reacocard (@reacocard) for the git template commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.