This commit is contained in:
parent
78e18c55c5
commit
40427ca751
19
content/notes/2020/06/2020-06-25--git-main.md
Normal file
19
content/notes/2020/06/2020-06-25--git-main.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Set default git branch to main
|
||||
author: Yarmo Mackenbach
|
||||
slug: git-main
|
||||
date: "2020-06-25 11:37:43"
|
||||
published: true
|
||||
---
|
||||
|
||||
For a while, we've all been seeing the "switch git default branch from master to main" posts, the earliest I recall having been [written by Scott Hanselman](https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx). I've been postponing the change for a bit, but it was [the post by Kristófer Reykjalín](https://www.thorlaksson.com/im-changing-the-default-branch-name-in-my-git-repositories-and-you-should-too/) that gave the required motivation to go out and just do it.
|
||||
|
||||
For new repositories, Gitea already has [the option to set the default branch name](https://github.com/go-gitea/gitea/pull/10803).
|
||||
|
||||
For exiting repositories, the [commands provided by Scott](https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx) work perfectly:
|
||||
|
||||
```
|
||||
git checkout master; git branch -m master main; git push -u origin main
|
||||
```
|
||||
|
||||
As for my website, here's the [commit](https://git.yarmo.eu/yarmo/yarmo.eu/commit/78e18c55c59c8e65e99013718cd42154ddb7ebd6) that completed the transition, making sure my CI/CD solution knows what to listen to.
|
Loading…
x
Reference in New Issue
Block a user