Git Commit Messages | Best Practices & Guidelines


Here’s a concise, “standard practice” cheat-sheet you can follow for Git commit messages. It blends Conventional Commits style (widely adopted) with practical DevOps/Jira usage.
Core Format
<type>(<optional-scope>): <short imperative summary>
<blank line>
<body: what & why, not just how>
<blank line>
<footer: issue refs, breaking changes, co-author>
Imperative mood (“Add”, “Fix”, “Update”), max ~50 chars subject, wrap body ~72 chars, no trailing period in subject.
Standard <type> Keywords (top tier)
Type | When to Use | Example Subject |
feat | New user-visible feature/functionality. | feat(auth): add OAuth2 login |
fix | Bug fix (user-impacting defect). | fix(api): handle null user_id |
docs | Documentation only. | docs(readme): add setup for EKS |
style | Formatting, whitespace, lint fixes; no code behavior change. | style: run gofmt over handlers |
refactor | Code restructure w/o behavior change (cleanups, modularization). | refactor(db): extract conn pool |
perf | Performance improvement. | perf(cache): reduce redis calls |
test | Add/update tests only. | test(payments): add retry cases |
build | Build system, packaging, artifact changes (Maven, npm, Dockerfile). | build(docker): multi-stage image |
ci | CI/CD pipeline config (Jenkinsfile, GitHub Actions, Argo, etc.). | ci: add security scan stage |
chore | Maintenance tasks that don’t fit others (deps bumps, cleanup). | chore: bump terraform modules |
revert | Revert a prior commit. Include hash in body. | revert: feat(auth) oauth2 login |
Extended Scenarios (DevOps-Friendly)
Scenario | Recommended Prefix | Example |
Infra as Code change (Terraform, CloudFormation) that affects runtime | infra or build/chore (team choice) | infra(vpc): add nat gateway in ap-south-1 |
Kubernetes manifests / Helm chart update | build/infra | build(helm): update image tag to v1.4.2 |
Secrets rotation / config change | chore/config | chore(config): rotate rds creds |
Security patch (CVE fix, policy hardening) | sec or fix | sec(openssl): patch CVE-2025-1234 |
Observability config (Prometheus, Grafana dashboards) | chore/obs or build/monitoring | chore(obs): add 95p latency panel |
Release version bump | chore(release) | chore(release): cut 1.3.0 |
Hotfix to production | fix! or hotfix (team style) | fix!(prod): rollback bad migration |
Note: Custom types (infra, sec, obs) are fine if your team agrees and tooling supports them. Otherwise map to closest core type.
Good Subject Verb Starters
Add, Update, Remove, Fix, Refactor, Rename, Improve, Optimize, Configure, Revert, Bump, Merge.
Referencing Issues / Tickets
Add in footer (preferred) or inline after summary if policy requires:
Footer style:
Closes #123
Refs JIRA-456
Subject inline (short teams):
feat(auth): add MFA (JIRA-789)
Multi-Line Example
feat(payments): support UPI autopay
Adds recurring UPI mandate flow for Indian merchants.
Includes gateway callback handler and retry logic.
Closes FIN-3421.
Quick Do / Don’t
Do
Write the why in body (context helps code reviewers + future you).
Group related changes; avoid “misc fixes”.
Use scope for service/module (auth, api, ui, infra, helm, cicd).
Don’t
Combine unrelated feature + refactor.
Write past tense (“Added”); use imperative (“Add”).
Dump auto-generated build logs in commit message.
Fast Mapping Cheat (copy/paste)
feat: new feature
fix: bug fix
docs: docs only
style: formatting
refactor: code restructure
perf: performance boost
test: tests only
build: build/packaging
ci: pipeline/automation
chore: maintenance
revert: rollback commit
Need this as a reusable snippet for your team’s README/contributing guide or a commit-lint config? Say the word and I’ll generate it.
Additional Prefixes (Optional)
Some teams add custom scopes:
feat(auth): add JWT token generation
fix(ui): resolve button alignment
Best Practices for Commit Messages
Use imperative tone – "add feature" not "added feature".
Keep subject < 50 characters, and capitalize the first letter.
Body (optional) – Explain why the change was made, not just what.
Example:
feat: add password reset endpoint
- Implemented API /reset-password
- Integrated with AWS SES for email
- Added unit tests
Scenarios & Commit Examples
New feature:
feat: add S3 storage support
Bug fix:
fix: handle timeout issue in API calls
Hotfix in production:
fix: patch security vulnerability in JWT
Code cleanup:
chore: remove deprecated functions
Pipeline change:
ci: add Slack notification for failed builds
Database migration:
feat(db): add migration script for user table
Git commit message best practices and examples specifically for a Cloud & DevOps Engineer, covering the types of tasks you commonly handle — infra provisioning, CI/CD, observability, containerization, scripting, etc.
✅ Git Commit Message Convention for Cloud & DevOps Engineers
Format:
php-templateCopyEdit<type>(<scope>): <short summary>
[Optional detailed body]
🔧 1. Infrastructure as Code (Terraform, CloudFormation)
Scenario | Commit Message |
Adding new module | feat(iac): add VPC module with public/private subnets |
Modifying resources | refactor(iac): update EC2 instance type to t4g.small |
Removing unused code | chore(iac): remove legacy S3 bucket resource |
Fixing syntax errors | fix(iac): correct variable reference in outputs.tf |
🛠️ 2. CI/CD Pipeline Changes (Jenkins, GitHub Actions, Azure DevOps)
Scenario | Commit Message |
Add pipeline | feat(ci): add GitHub Actions workflow for backend |
Fix build failure | fix(ci): update Docker build context path |
Modify Jenkinsfile | chore(ci): parameterize Jenkinsfile for env selection |
Add Slack alerts | feat(ci): notify #devops-alerts on build failure |
☁️ 3. Cloud Configurations (AWS/GCP/Azure)
Scenario | Commit Message |
Add new AWS resource | feat(cloud): add RDS instance for MySQL DB |
Update IAM permissions | fix(cloud): grant S3 write access to Lambda role |
Delete unused resource | chore(cloud): remove unused ECR repo |
🐳 4. Containerization (Docker, Kubernetes)
Scenario | Commit Message |
Create Dockerfile | feat(docker): add Dockerfile for backend service |
Optimize image | perf(docker): reduce image size using multi-stage build |
Add Helm chart | feat(k8s): add Helm chart for payments service |
Modify deployment | refactor(k8s): increase replica count to 3 |
Fix readiness issue | fix(k8s): add proper readinessProbe for backend |
🔒 5. Security & Compliance
Scenario | Commit Message |
Add security group rule | feat(security): allow HTTPS on port 443 in SG |
Fix vulnerability | fix(security): upgrade Log4j to safe version |
Enable encryption | feat(security): enable encryption on S3 bucket |
📈 6. Monitoring & Observability (Prometheus, CloudWatch, Grafana)
Scenario | Commit Message |
Add metrics | feat(monitoring): expose HTTP request metrics to Prometheus |
Update dashboard | chore(grafana): update dashboard with new latency panel |
Fix alert rule | fix(alert): correct threshold for memory usage alert |
📜 7. Automation Scripts (Shell, Python, Lambda)
Scenario | Commit Message |
Add automation | feat(script): automate backup of EBS snapshots |
Modify logic | refactor(script): replace curl with AWS CLI for uploads |
Fix error | fix(script): handle null env vars in deploy.sh |
📄 8. Documentation & Runbooks
Scenario | Commit Message |
Add new doc | docs: add deployment guide for QA environment |
Update existing | docs: update Terraform module usage instructions |
Fix typo | docs: fix typo in RDS connection string example |
🧪 9. Testing Infrastructure
Scenario | Commit Message |
Add test env config | feat(env): add test namespace in EKS |
Add pipeline test step | test(ci): add security scan using Trivy |
Fix flaky test step | fix(ci): increase timeout for integration test step |
🔁 10. Reverting or Rollbacks
Scenario | Commit Message |
Revert breaking change | revert: revert "feat(k8s): add HPA config to backend" |
Rollback config | chore: rollback to stable config for staging |
📌 Quick Summary Table
Type | Use Case | Example |
feat: | New infra, pipeline, resource | feat(iac): add CloudFront CDN config |
fix: | Fix errors, bugs, issues | fix(k8s): resolve crashloop for init container |
refactor: | Code restructure, cleanup | refactor(script): optimize backup loop |
chore: | Maintenance tasks, deletions | chore: remove unused Lambda trigger |
ci: | Pipeline changes | ci: update Jenkins agent version |
build: | Dockerfile, image-related | build: add image tag with Git SHA |
perf: | Performance improvements | perf: reduce DB startup time on RDS |
docs: | Documentation | docs: add runbook for restoring backups |
test: | Infra test cases, pipeline checks | test: add sanity check to deployment step |
revert: | Undo previous commit | revert: revert change to Nginx config |
Subscribe to my newsletter
Read articles from Aditya Patil directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Aditya Patil
Aditya Patil
Hi, I'm Aditya — a Cloud & DevOps Engineer passionate about automating everything from CI/CD pipelines to multi-cloud infrastructure. I specialize in AWS, Kubernetes, Terraform, and GitOps tools like Argo CD. I’ve helped teams scale applications, cut cloud costs by 90%, and build disaster-ready infra. I love sharing real-world DevOps lessons, cloud cost optimization tips, and infrastructure design patterns. Let’s connect and simplify the cloud — one YAML file at a time ☁️⚙️