Git Best Practices Checklist: DevOps Team Guidelines and Standards
Building a Culture of Git Excellence
Git is more than just a version control toolβit's the foundation of your team's collaboration, deployment pipeline, and code integrity. This comprehensive checklist codifies industry-proven best practices into actionable items your team can implement today. Use it as a living document during onboarding, code reviews, and process retrospectives.
How to Use This Checklist: Each item includes a checkbox for tracking, a priority badge (Required/Recommended/Optional/Team-specific), a detailed explanation, and examples. Work through sections progressively, or use as a reference during PR reviews. The scorecard at the end helps measure your team's Git maturity.
<type>[optional scope]: <description> for automatic changelog generation and semantic versioning.
fix(api): handle null response in user service
docs: update README with setup instructions
refactor: simplify payment validation logic
test: add unit tests for login component
β "Added validation"
β "Adding validation"
β "Adds validation"
commit 1: "fix: resolve null pointer in login"
commit 2: "refactor: extract validation logic"
commit 3: "style: format code according to prettier"
β Bad: One commit
"fix login and refactor validation and format code"
git add -p to stage only parts of files for atomic commits.
Why: Prevent abuse of public endpoints following security audit
How: Using token bucket algorithm with Redis backend
Ticket: SEC-1234
Alternative considered: Leaky bucket - rejected due to burst handling requirements
fix: correct calculation in tax module JIRA-789
docs: update deployment guide [DEVOPS-234]
node_modules/
dist/
build/
*.log
.env
.idea/
*.class
vendor/
β’ GitHub Flow: main + feature branches. Simple, continuous delivery.
β’ GitFlow: main, develop, feature/*, release/*, hotfix/*. Good for scheduled releases.
β’ GitLab Flow: Adds environment branches (production, staging).
β’ Trunk-based: Short-lived branches, direct merges to main.
feature/JIRA-123-payment-integration
bugfix/login-error
hotfix/security-patch-2.1.1
release/v2.5.0
chore/update-dependencies
git push origin --delete feature/old-branch
# Delete local branch
git branch -d feature/merged-branch
# Prune remote-tracking branches
git remote prune origin
β’ Require pull request reviews (minimum 2)
β’ Dismiss stale reviews
β’ Require status checks (CI passes)
β’ Require signed commits
β’ No force pushes
β’ Linear history (no merge commits)
Description:
## What
Implements token bucket rate limiting on public API routes
## Why
Following security audit SEC-123, we need protection against DoS attacks
## How
Uses Redis for distributed rate limiting with configurable limits
## Testing
- Unit tests added
- Manual tested with 100 requests/second
## Screenshots
[image]
- [ ] Documentation updated
- [ ] No secrets committed
- [ ] Follows commit message conventions
- [ ] Branch up to date with main
API_KEY = "sk_live_12345abcde"
# Right: environment variables
API_KEY = process.env.API_KEY
# Or secrets manager
API_KEY = aws secretsmanager get-secret ...
#!/bin/sh
git diff --cached | grep -E "(password|api_key|secret|token|AKIA)" && exit 1
# Or use tools like git-secrets, truffleHog, gitleaks
git config --global user.signingkey [KEY-ID]
git config --global commit.gpgSign true
# Sign commit
git commit -S -m "feat: add payment"
on:
push:
paths:
- 'api/**'
- 'shared-libs/**'
/api/ @backend-team
/web/ @frontend-team
/infra/ @devops-team
git gc periodically to optimize performance.
git count-objects -vH
# Find large files
git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | grep "^blob" | sort -k3 -n -r | head -10
| Category | Key Practices |
|---|---|
| Commits | Conventional format, atomic, present tense, no secrets |
| Branches | Consistent naming, short-lived, delete after merge, protect main |
| PRs | Small, descriptive, reviewed, CI passing |
| Security | Signed commits, secret scanning, SSH keys, rotate access |
| CI/CD | Run on all branches, require status checks, cache dependencies |
| Team | Documented workflow, onboarding, retrospectives |
| Maintenance | Monitor size, LFS for binaries, backups |
| Releases | Tag releases, changelog, hotfix process |
Best Practices FAQ
Balance enforcement with developer experience:
- Automate what you can: Use pre-commit hooks for formatting, CI for tests, branch protection for rules.
- Start small: Implement 2-3 practices at a time. Let the team adapt before adding more.
- Lead by example: Senior team members should model good practices.
- Document the "why": Explain the reasoning behind each practice.
- Provide tooling: Create aliases, scripts, and templates that make following practices easier.
- Review periodically: Retrospect on practicesβare they helping? Are any causing unnecessary overhead?
Strategies for legacy codebases:
- Don't rewrite history: For shared repositories, avoid cleaning up old commits. Start fresh with new commits following standards.
- Document the baseline: Note in README which practices apply to new contributions.
- Gradual improvement: When touching old files, you can improve them (boy scout rule).
- Consider branch rewrite for critical repos: If the repository is small and team can coordinate, use filter-repo to clean history once.
- Update contribution guide: Clearly state expectations for new commits regardless of history.
Recommended review cadence:
- Quarterly team retrospectives: Discuss what's working, what's not.
- After onboarding new team members: Fresh eyes often spot confusing practices.
- When adopting new tools: CI/CD changes may enable new practices.
- When scaling team size: What worked for 5 people may not work for 20.
- Annually formal review: Document any changes and communicate to team.
For a team just starting with Git best practices, focus on:
Commit message convention + branch protection on main.
These two practices provide immediate benefits:
- Commit messages make history readable and enable automation.
- Branch protection prevents mistakes reaching main and enforces reviews.
From there, gradually add automated testing, signed commits, and other practices as the team matures.