New GitHub Repositories Default to Main Branch

New GitHub Repositories Default to Main Branch

All newly created GitHub repositories will default to 'main' for their main branch from today. In addition, existing repositories can also rename the 'master' branch; read on to find out why you might want to do this, and the support that GitHub is providing to make this transition seamless.

As of today, all newly created GitHub repositories will have a default branch of 'main' instead of 'master'. This change reflects a similar one from the upstream Git project which started the transition from using 'master' for their default branch name, allowing projects to customise what the default branch of a project is called. From the Software Freedom Conservancy announcement regarding Git and Branch Names earlier this year:

Both Conservancy and the Git project are aware that the initial branch name, ‘master’, is offensive to some people and we empathize with those hurt by the use of that term.

Existing versions of Git are capable of working with any branch name; there's nothing special about ‘master’ except that it has historically been the name used for the first branch when creating a new repository from scratch (with the git init command). Thus many projects use it to represent the primary line of development. We support and encourage projects to switch to branch names that are meaningful and inclusive, and we'll be adding features to Git to make it even easier to use a different default for new projects.

As a first step, Git will add a mechanism to allow users to specify the default used as the name of the first branch when creating a new repository. Also, consistent with its project governance, Git has undertaken a community process to explore changing the name of the first branch created automatically for new repositories away from ‘master’. That change is currently being discussed on our mailing list. As always, changes in Git's core will minimize disruption for Git's users and will include appropriate deprecation periods.

Git version 2.28 introduced a new configuration optioninit.defaultBranch, that can be used to define what the default branch name is called. This defaults to master (for backwards compatibility) but can be configured in a user's defaults configuration, or systemwide.

Projects appear to have settled on using main as the preferred name for the default branch, although like master this is purely conventional. To support this, GitHub has announced that they will support renaming of the default branch while being able to redirect requests from deleted branchs to the new default branch name, along with supporting GitHub pages being created from a named branch instead of the default. There are also user/organisation/enterprise settings that allow customisation of the default branch name, in the same way that the client can be configured.

There are other planned enhancements, such as allowing open PRs and issues to be retargeted automatically to the default branch name, which GitHub is planning to do later in the year.

Some open-source projects have already switched their default branch to use 'main': for example, Apple's Swift programming language, along with support libraries like swift-nio and the newly released swift-system have switched to using 'main' as the default branch name. Other programming languages like Python and Rust have not yet switched.

git github git development devops news

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire Dedicated DevOps Developers

Hire our Dedicated DevOps Developers who have in-depth skills and expertise to develop an interactive and secure web application. Get custom DevOps solutions for your project.

Hire DevOps Developer

Looking to hire top DevOps developers at affordable prices? **[Hire DevOps Developer](https://hourlydeveloper.io/hire-dedicated-devops-developer/ "Hire DevOps Developer")** from **[HourlyDeveloper.io](https://hourlydeveloper.io/...

Top News Mobile App Development Company

Get a Free Quote on Android App Development, iPhone App Development, Ionic App Development, Video Development, ASO, SEO, Google Ads/Adwords, SEO for your app Idea.

Things About Git and Github You Need to Know as Developer

Hey there, in this blog we are going to learn about Git and Github. As a developer, you might have come across the terms Git and Github but do you understand why do you need or why you are using these? Let’s dig a little deeper to understand these terms.

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.