Setting Up Git Workflow and Branching Strategy
20 items · Technical · Medium difficulty · 45 min
Set up a clear Git branching model, PR rules, and commit linting for your repo.
-
Choose branching model
Pick the model that fits your release cadence and team size.
-
Evaluate GitHub Flow
Simple feature branches + short-lived PRs, good for continuous deploy.
-
Evaluate Gitflow
Structured releases with long-lived release and hotfix branches.
-
Evaluate trunk-based development
Short-lived branches, feature flags, and frequent integration to main.
-
Define branch naming convention
Create clear prefix rules and examples for all branch types.
-
Adopt prefix rules (feature/, fix/, chore/)
Standardize prefixes to identify purpose at a glance.
-
Include ticket or issue IDs in branch names
Use PROJ-123 or #123 to link branches to work items.
-
Create a pull request (PR) template
Include description, checklist, testing steps, and linked issues.
-
Set required reviewers and review rules
Decide on number of reviewers, review scope, and approval rules.
-
Add a CODEOWNERS file to auto-request reviewers
Map paths to teams to ensure consistent reviewer assignment.
-
Choose repository merge strategy
Decide between merge commits, squash, or rebase for your history.
-
Prefer squash merges for feature PRs
Use squash to keep main history linear and grouped by PR.
-
Protect main (or trunk) branch
Enable protections: require PR, disallow force pushes, and block direct commits.
-
Require passing CI and status checks before merge
Block merges until tests and linters pass on the PR branch.
-
Enforce semantic commit messages
Adopt a commit message convention (Conventional Commits, etc.).
-
Add commit-msg hook with commitlint
Use husky or native hooks to validate messages before commit.
-
Enable automatic deletion of merged branches
Turn on repo setting or a cleanup action to remove merged branches.
-
Document the workflow and examples in the repo
Add README section with diagrams, commands, and examples.
-
Announce the workflow and run a short onboarding
Share docs, hold a demo, and answer team questions.
-
Review and iterate the workflow regularly
Collect feedback after a release and adjust rules quarterly.
Printed from TickYouOff — the interactive version tracks your progress and can be shared with others.