git branch --delete master
git
version 2.28.0, released one week ago, includes a simple but nice new feature:
init: allow setting the default for the initial branch name via the config
What does this mean?
Changing new repositories
When creating a git repository using git init
, git will create a default branch for you.1 Traditionally, this branch is called “master”, so git creates this branch and you can begin staging and committing files.
Should you find this name distasteful, you can change the name of the branch at any time. The git invocation to do so is
git branch --move master whatever
As of this newest release, git can do this for you. To set the default branch name to main
for all repos your user creates, you will want to edit the so-called global git configuration:
git config --global init.defaultBranch main
Any new repository you initialize will now use the default branch main
.
Changing existing repositories
This setting only affects new repositories that you create in the future — but changing an existing repo is not difficult.
From the existing repo, rename the branch:
git branch --move master main
Push your new branch (assuming the remote repository is named “origin”):
git push origin main
Finally, delete the remote’s original branch2:
git push origin --delete master
In three steps you have renamed a git branch without making a big deal out of it, all while avoiding the wrath of internet reactionaries.
more from the friends of danso:
ETS Match Specification Pitfall: Maps
February 9During my work, I had a problem where I needed to efficiently write tree-shaped data. I also needed the ability to query ranges of the data. I reached for ETS tables, using the ordered_set table setting, and relied on match specifications to read ranges from the…
via Richard KallosDan Savage on the Recent Inauguration
January 30I've been reading and listening to Dan Savage for decades. He's a sex & advice columnist that started out in the back pages of a Seattle Weekly but who's grown in reach and popularity dramatically over the years. He spearheaded oppositio…
via Searching For TaoDevelopment of rustc_codegen_gcc #2
January 30A couple months ago, I wrote an article that described the challenges we had to do the previous sync from the Rust repo to rustc_codegen_gcc. (if you don’t know what a sync is, please read that blog article). We also had many...
via Antoyo's Bloggenerated by openring