Better git
Hygiene
I need to stop throwing all my code at main yolo style!
I am trying reaaaly hard to commit what I do publicly, but it's hard to put ones self out there like this. I shall continue to blog and code in the view of all so its time to freshen up my git
hygiene.
GitOps
A framework that uses Git as a source control system to manage infrastructure and application code deployments.
IaC
Infrastructure as code
(IaC) is the practice of keeping all infrastructure configuration stored as code. This automates the provisioning of IT infrastructure by using these configuration files.
MRs
GitOps uses merge requests (MRs) or pull requests (PRs) as the change mechanism for all infrastructure updates. A merge commits to your main branch, and serves as an audit log or audit trail.
CI
/ CD
Automates infrastructure updates using a Git workflow with continuous integration and continuous delivery (CI/CD). When new code is merged, the CI/CD pipeline enacts the change in the environment.
In Practice
First step is always going to be STOP committing everything to main!
All changes should be merged in via Pull Requests from other feature branches or from a fork. This way everything gets reviewed by basic branch protection rules before merging into main.
Owners of the repository and the Organization it lives in can always force the merge even if the PR hasn’t been reviewed.
No commit main
Setup branch protection from the web UI inside the repository you want to effect, navigate to Settings
--> Branches
--> Protected Branches
select main
.
Enable the following settings: - Protect this branch - Require pull request reviews before merging - Dismiss stale pull request approvals when new commits are pushed - Include administrators
Stops even me from bypassing the rules.