From a5aa75fd04a71cd8236b8c8481a067c0a47b24b9 Mon Sep 17 00:00:00 2001 From: James Couball Date: Fri, 6 Jun 2025 14:46:10 -0700 Subject: [PATCH 1/2] chore: update the project's default branch from 'master' to 'main' --- .github/pull_request_template.md | 2 +- .github/workflows/continuous_integration.yml | 2 +- .github/workflows/enforce_conventional_commits.yml | 2 +- .../experimental_continuous_integration.yml | 2 +- .github/workflows/release.yml | 2 +- README.md | 14 +++++++------- bin/test | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 63e23392..b2c28b62 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,4 @@ -Review our [guidelines for contributing](https://github.com/ruby-git/ruby-git/blob/master/CONTRIBUTING.md) to this repository. A good start is to: +Review our [guidelines for contributing](https://github.com/ruby-git/ruby-git/blob/main/CONTRIBUTING.md) to this repository. A good start is to: * Write tests for your changes * Run `rake` before pushing diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index c21e97cd..0e7cd259 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -2,7 +2,7 @@ name: CI on: pull_request: - branches: [master] + branches: [main] workflow_dispatch: jobs: diff --git a/.github/workflows/enforce_conventional_commits.yml b/.github/workflows/enforce_conventional_commits.yml index 8aaa93f8..b995ef1a 100644 --- a/.github/workflows/enforce_conventional_commits.yml +++ b/.github/workflows/enforce_conventional_commits.yml @@ -7,7 +7,7 @@ permissions: on: pull_request: branches: - - master + - main jobs: commit-lint: diff --git a/.github/workflows/experimental_continuous_integration.yml b/.github/workflows/experimental_continuous_integration.yml index 488ab797..b1256714 100644 --- a/.github/workflows/experimental_continuous_integration.yml +++ b/.github/workflows/experimental_continuous_integration.yml @@ -2,7 +2,7 @@ name: CI Experimental on: push: - branches: [master] + branches: [main] workflow_dispatch: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eaea43f1..607f16ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ description: | on: push: - branches: ["master"] + branches: ["main"] workflow_dispatch: diff --git a/README.md b/README.md index 74e6ad4c..18671023 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Gem Version](https://badge.fury.io/rb/git.svg)](https://badge.fury.io/rb/git) [![Documentation](https://img.shields.io/badge/Documentation-Latest-green)](https://rubydoc.info/gems/git/) [![Change Log](https://img.shields.io/badge/CHANGELOG-Latest-green)](https://rubydoc.info/gems/git/file/CHANGELOG.md) -[![Build Status](https://github.com/ruby-git/ruby-git/workflows/CI/badge.svg?branch=master)](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI) +[![Build Status](https://github.com/ruby-git/ruby-git/workflows/CI/badge.svg?branch=main)](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org) - [📢 We've Switched to Conventional Commits 📢](#-weve-switched-to-conventional-commits-) @@ -275,8 +275,8 @@ g.branches # returns Git::Branch objects g.branches.local g.current_branch g.branches.remote -g.branches[:master].gcommit -g.branches['origin/master'].gcommit +g.branches[:main].gcommit +g.branches['origin/main'].gcommit g.grep('hello') # implies HEAD g.blob('v2.5:Makefile').grep('hello') @@ -333,7 +333,7 @@ Git.ls_remote('https://github.com/ruby-git/ruby-git.git') # returns a hash conta Git.ls_remote('/path/to/local/repo') Git.ls_remote() # same as Git.ls_remote('.') -Git.default_branch('https://github.com/ruby-git/ruby-git') #=> 'master' +Git.default_branch('https://github.com/ruby-git/ruby-git') #=> 'main' ``` And here are the operations that will need to write to your git repository. @@ -406,13 +406,13 @@ g.branch('new_branch') # creates new or fetches existing g.branch('new_branch').checkout g.branch('new_branch').delete g.branch('existing_branch').checkout -g.branch('master').contains?('existing_branch') +g.branch('main').contains?('existing_branch') # delete remote branch g.push('origin', 'remote_branch_name', force: true, delete: true) g.checkout('new_branch') -g.checkout('new_branch', new_branch: true, start_point: 'master') +g.checkout('new_branch', new_branch: true, start_point: 'main') g.checkout(g.branch('new_branch')) g.branch(name).merge(branch2) @@ -422,7 +422,7 @@ g.branch(name).in_branch(message) { # add files } # auto-commits g.merge('new_branch') g.merge('new_branch', 'merge commit message', no_ff: true) g.merge('origin/remote_branch') -g.merge(g.branch('master')) +g.merge(g.branch('main')) g.merge([branch1, branch2]) g.merge_base('branch1', 'branch2') diff --git a/bin/test b/bin/test index 599ecbd9..3b2e91d2 100755 --- a/bin/test +++ b/bin/test @@ -11,7 +11,7 @@ require 'bundler/setup' `git config --global user.email "git@example.com"` if `git config --global user.email`.empty? `git config --global user.name "GitExample"` if `git config --global user.name`.empty? -`git config --global init.defaultBranch master` if `git config --global init.defaultBranch`.empty? +`git config --global init.defaultBranch main` if `git config --global init.defaultBranch`.empty? project_root = File.expand_path(File.join(__dir__, '..')) From e04f08e202ae54286033b4d0a75c47f124bd63e2 Mon Sep 17 00:00:00 2001 From: James Couball Date: Fri, 6 Jun 2025 14:59:03 -0700 Subject: [PATCH 2/2] chore: announce default branch change in README --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 18671023..f62b42f9 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ [![Build Status](https://github.com/ruby-git/ruby-git/workflows/CI/badge.svg?branch=main)](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org) +- [📢 Default Branch Rename 📢](#-default-branch-rename-) - [📢 We've Switched to Conventional Commits 📢](#-weve-switched-to-conventional-commits-) - [Summary](#summary) - [Install](#install) @@ -21,6 +22,14 @@ - [Ruby version support policy](#ruby-version-support-policy) - [License](#license) +## 📢 Default Branch Rename 📢 + +On June 6th, 2025, the default branch was renamed from 'master' to 'main'. + +Instructions for renaming your local or forked branch to match can be found in the +gist [Default Branch Name +Change](https://gist.github.com/jcouball/580a10e395f7fdfaaa4297bbe816cc7d). + ## 📢 We've Switched to Conventional Commits 📢 To enhance our development workflow, enable automated changelog generation, and pave