Removing 'master' from your git repos
I recently read that GitHub is planning to switch the default branch name from master to something more inclusive. Here's how you can make these changes locally as well.
I created a file ~/.config/git/template/HEAD
with the following content:
ref: refs/head/main
Then edit your ~/.gitconfig
file to point to this template:
[init]
templateDir = ~/.config/git/template
And that's it! Now running git init
will create an empty git repository with 'main' as your default branch instead of 'master'. Of course, if you'd prefer 'primary' or something else, just make the changes above.
What about your existing repos? You can run
git branch -m master main
to rename the master branch to main. The push your changes to master. Afterwards, navigate to your GitHub repo's settings, and change the default branch to 'main'.