1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【GitHub】ブランチ削除防止の設定

1
Last updated at Posted at 2025-06-04

はじめに

リポジトリ内の重要なブランチは誤って削除されるのを防ぎましょう。
誤操作によるトラブル防止やCI/CDなどブランチ前提の仕組みを壊さないために有効です。

これにより
・GitHub上で対象ブランチの削除ボタンを押しても削除できなくなります。

手順

1. リポジトリ設定ページの表示

  • GitHubで対象リポジトリを開く
  • 上部メニューから Settings をクリック
  • 左メニューの Branches を選択

2. ブランチ保護ルールの追加

  • Branch protection rules内の Add rule または Create rule をクリック
  • Branch name patternに保護対象のブランチ名を入力
    スクリーンショット 2025-06-05 233602.png

3. 削除防止オプションの有効化

  • オプション一覧から Restrict deletions にチェック
  • ページ下部の Create または Save changes をクリック
    スクリーンショット 2025-06-05 233621.png

補足

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?