Chapter Fourteen

Best Practices and Anti-Patterns

The disciplines that keep Git history, team collaboration, and CI/CD pipelines safe and readable — consolidated into the rules you apply per change, and the recurring anti-patterns to recognize before they bite.

4 topics

This closing chapter does not introduce new mechanics — it consolidates the rules established across the course into the working discipline you actually apply: how to shape commits and branches, how to run a fast and safe pull-request flow, and how to keep a GitHub Actions pipeline secure and cheap. Each best-practices page pairs the discipline with the specific mistakes that violate it.

The final page inverts the others into a catalog of common anti-patterns, each with its specific consequence and fix, so you can recognize a failing pattern on sight. Treat the whole chapter as a checklist: make the safe path the easy path, and most of the costly mistakes simply cannot merge.

Three practice domains, plus what to avoid
Git
Small focused commits, clear messages, rebase local work, never rewrite shared history.
GitHub collaboration
Short-lived branches, reviewable PRs, branch protection and CODEOWNERS on what matters.
GitHub Actions
Pin actions, least-privilege tokens with OIDC, build once and promote one artifact.
Anti-patterns
Force-push to main, secrets in logs, rebuilding per environment, blanket write permissions.

Topics in This Chapter