Proposal: renaming 'master' branch to 'main'

Daniel P. Berrangé berrange at redhat.com
Tue Jan 17 13:09:36 UTC 2023


On Tue, Jan 17, 2023 at 09:02:23AM +0100, Martin Kletzander wrote:
> On Mon, Jan 16, 2023 at 02:55:10PM +0000, Daniel P. Berrangé wrote:
> > I don't recall exactly when it first came up, but it has been a few years
> > now since the idea of moving away from 'master' as the git default branch
> > name became a topic in OSS communities. Far from the first mention:
> > 
> >  https://sfconservancy.org/news/2020/jun/23/gitbranchname/
> > 
> > Both gitlab.com and github.com now default to 'main' as the default
> > branch when creating new repositories:
> > 
> >  https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/
> >  https://github.blog/changelog/2020-10-01-the-default-branch-for-newly-created-repositories-is-now-main/
> > 
> > Some notable large open source projects have done, (or at least started)
> > to rename the default branch in their existing projects too. eg
> > 
> >  GNOME: https://gitlab.gnome.org/GNOME/glib/-/issues/2348
> > Fedora: https://fedoraproject.org/wiki/Changes/GitRepos-master-to-main
> > 
> > For libosinfo we did a rename last year. There was a little disruption
> > but nothing too terrible, IIRC, missing weblate translation branch
> > update was our main mistake.
> > 
> > I'd suggest it is time to libvirt to get on this train and rename our
> > default branch to 'main' in all repositories.
> > 
> > There are essentially two options
> > 
> >  * Rename 'master' to 'main'
> > 
> >    With this, anyone pulling from an existing checkout will get an
> >    error telling them that 'master' does not exist. It won't tell
> >    them about 'main', but at least it gives them a sign that something
> >    in their checkout probably needs changing.
> > 
> >    Downside is that any URLs pointing to source files / commits with
> >    a branch name in the URL will become 404s.
> > 
> >  * Clone 'master' to 'main'
> > 
> >    With this, anyone pulling from an existing checkout will get no
> >    updates. It is very easy for people to not realize that they are
> >    tracking a branch which is no longer used
> > 
> >    Downside is also that the undesirable term 'master' remains
> >    present in the repo, even if unused. We might also miss places
> >    which still refer to 'master' which will end up outdated
> 
> We can also then remove everything from master and just keep a README
> file explaining the situation.

Oh, I should have mentioned that as an option, and said that I
consider it undesirable. That delete commit effectively forks
'master' history from 'main', meaning there's no way back from
the rename. We did this for some of the stable branches in
libvirt in the past and I really regret that, we should have
just left them idle IMHO.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


More information about the libvir-list mailing list