Switching the default branch to 'development' #git

๐Ÿ•ž๏ธŽ - 2020-06-21

I have decided to switch my public git repositories to use a branch called 'development' as the default branch.

I find the terms 'development' and 'production' much easier to interpret. I have seen projects where 'master' is the branch development happens on continuously, and then there is a separate branch for releases, and I have seen the opposite, where the 'master' branch is never committed to, except when merging to do a release.

So when the term 'master' is seen as problematic, why not switch to something less ambiguous?

It is not that complicated to do:

I have a single clone of most of my repositories, so I went to that, and ran:

git checkout master
git branch -m master development
git push -u origin development

Then I went to the bare repository on my server, where I "host" the public repositories, and ran:

git symbolic-ref HEAD refs/heads/development

And finally in the clone, I ran:

git push origin --delete master

And Bob is my uncle.

For anybody that have cloned any of my public repositories, there are two options: a) make a new clone, or b) run these commands in your clone:

git checkout master
git branch -m master development
git fetch
git branch --unset-upstream
git branch -u origin/development
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/development
git remote prune origin

While finding these commands, I learned about symbolic-ref, so if you check out my emacs repository, you get the branch scratch/gtk-x-disconnect by default now. Nice!

Add comment

To avoid spam many websites make you fill out a CAPTCHA, or log in via an account at a corporation such as Twitter, Facebook, Google or even Microsoft GitHub.

I have chosen to use a more old school method of spam prevention.

To post a comment here, you need to:

ยน Such as Thunderbird, Pan, slrn or Gnus (part of Emacs).

Or, you can fill in this form: