Git master branch
There has been a lot of discussion about the master branch in git, which is the default branch for git. It is based on an oppressive metaphor and it seems like now is a good time to choose a new name.
Some of the suggestions I have seen are release, develop, stable, unstable, trunk, default (hello fellow Mercurial fans!) and thrash. It is clear that people are using the branch for different purposes as some of these are polar opposites. Maybe the answer to which name to choose for this branch is the same as it always seems to be “it depends…".
For instance, if you are using the branch with something like GitFlow a good name might be ready. If you are using it for continuous delivery it might make more sense to call it release. If you use it for integrating changes then trunk or develop might make more sense.
The consensus on a generic name seems to be going towards calling it main, which has the advantage (and disadvantage) of being somewhat similar to master.
To rename the branch for an existing project just follow these steps.
git branch -m master <new-name>
git push -u origin <new-name>
Don’t forget to change the default branch in your source code hosting service. Also update any other tools with the new branch name that might be pulling your code. Such as CI/CD, static analysis or licence scanning tools.
Final remark, besides choosing a better default it would be nice if git made the initial branch configurable with a command such as this.
git config --global init.branch main