Everyone at Thoth Tech has permission to create new GitHub repositories. To adhere to the Git Contribution guide, we suggest to implement the following GitHub settings:
- Delete merged branches automatically: enabled
- Access control: role-based with least privilege
- Branch protection: enabled
You can find these settings under the repository settings page.
This setting helps to reduce the number of branches that are already merged to the default branch. On large repository, this improves code checkout time and reduce disk storage.
- Go to the
Settings > General
page. For example,https://github.com/thoth-tech/handbook/settings
. - Scroll down to
After pull requests are merged, you can have head branches deleted automatically.
setting. - Enable
Automatically delete head branches
.
To reduce accidental deletion and risk of compromised accounts, we would like to keep elevated permissions to a smallest number of individual as possible. Generally, roles are assigned as follows:
- Senior Leads:
Admin
- Product & Delivery Leads:
Maintain
- Developers (everyone in the organisation):
Write
The administrators or repository creators can ensure the above roles assignment.
- Go to the
Settings > Access
page. For example,https://github.com/thoth-tech/handbook/settings/access
. - Select
Add teams
. - Type the team name and assign the roles as stated above.
- Repeat for the rest of the teams.
We recommend feature branch strategy and Pull request workflow for code development. This ensures code quality, knowledge sharing and collaboration. Pushing to the default branch must be prohibited.
- Go to the
Settings > Branches
page. For example,https://github.com/thoth-tech/handbook/settings/branches
. - Select
Add rule
. - Type the name of the default branch in the
Branch name pattern
text box. For example,main
. - Enable
Require a pull request before merging
.- Enable
Require approvals
. - Select
Required number of approvals before merging
according to the Code Review guidelines.
- Enable
- Enable
Require status checks to pass before merging
.- Ensure
Requires branches to be up to date before merging
is disabled.
- Ensure
- Enable
Include administrators
so everyone is subjected to the above rules when contributing. code to the repository. - Select
Create
.