git-flowやGitHub Flowで開発していると更新内容はmasterリポジトリにいきなりプッシュせず、別のブランチで作業してからmasterブランチに統合したいですが、操作ミスでmasterブランチにプッシュしてしまうこともあります。あらかじめmasterブランチへのダイレクトプッシュができないようにしておくことは、そんなうっかりミスを防ぐために有効な手段の一つだと思います。
masterブランチにgit push
しようとすると以下のようなメッセージを出してダイレクトプッシュを防ぐ設定がGitHubにはあります。その設定方法をメモしておきます。

2020年1月10日現在、以下の項目を有効にすると、GitHubリポジトリのmasterブランチへのダイレクトプッシュを防ぐことができます。
- Require pull request reviews before merging
- Include administrators
GitHubリポジトリにブラウザからアクセスし、Settings -> Branches -> Branch protection rulesを編集します。

ここで設定している内容は以下のヘルプページで紹介されています。
あわせて読みたい
Sign in for Software Support and Product Help - GitHub Support
Access your support options and sign in to your account for GitHub software support and product assistance. Get the help you need from our dedicated support tea...
git-flowやGitHub Flowは以下のページに概要が書かれています。
??IT


?y?}??zgit-flow?AGitHub Flow??J??????Ŏg???n?߂邽?߂ɂ??ꂾ???͊o???Ă?????
?{?A?ڂł́A?o?[?W?????Ǘ??V?X?e???uGit?v??Git?̃z?X?e?B???O?T?[?r?X??1?uGitHub?v??g?????߂ɕK?v?Ȓm?????b????????Ă??܂??B?ŏI??́A??????݂???o?[?W?????Ǘ??̃??[?N?t???[?̂?...
コメント