Git Workflow Best Practices
20 items · Technical · Medium difficulty · 30 min
Keep your Git history clean and PRs reviewable with these practical workflow rules.
-
Adopt a clear branch naming convention
Agree on prefixes and separators team-wide
-
Prefix feature branches with feature/ (e.g., feature/ABC-123-short-desc)
Include ticket ID and a short description
- Prefix bugfix branches with fix/ (e.g., fix/ABC-123-short-desc)
- Use release/, hotfix/, or chore/ for releases, urgent fixes, and maintenance
-
Create new branches from the correct base branch
Branch off main or develop per your team's branching model
-
Write concise, descriptive commit messages
Keep subject <=72 chars and start with a verb
-
Start commit subject with a verb and include ticket ID
Example: 'Add login validation (#123)'
-
Explain the reason in the commit body when necessary
Describe why the change was made, not just what
-
Make small, single-purpose commits
One logical change per commit eases review and rollback
-
Run tests and linters locally before committing
Fix obvious issues to keep CI builds green
-
Decide when to rebase vs merge according to team policy
Document the team's choice and use it consistently
-
Rebase your feature branch onto the latest base to keep a linear history
Rebase locally, resolve conflicts, and run tests afterwards
-
Use merge commits to record integration points or preserve history
Prefer merge commits for long-lived branches or releases
-
Open a Pull Request with a clear title and summary
Summarize changes, link tickets, and list breaking changes
-
Fill the PR template: summary, testing steps, and rollback plan
Use the project PR template to standardize required info
-
Request reviewers and assign code owners as needed
Ask specific reviewers and include domain experts
-
Ensure CI checks and required approvals pass before merging
Wait for a green build and mandated reviewer approvals
-
Squash or clean up commits before final merge
Use interactive rebase or squash merge to tidy history
-
Protect main branches: block direct pushes and require PRs & checks
Enable branch protection rules and required status checks
-
Delete stale branches after merge and keep the repo tidy
Remove merged branches locally and remotely; update tracking
Printed from TickYouOff — the interactive version tracks your progress and can be shared with others.