{"id":470,"date":"2025-09-27T04:30:25","date_gmt":"2025-09-27T04:30:25","guid":{"rendered":"https:\/\/blog.ngocha.biz\/?p=470"},"modified":"2025-09-27T04:30:25","modified_gmt":"2025-09-27T04:30:25","slug":"git-commit-standards-for-infrastructure-code","status":"publish","type":"post","link":"https:\/\/blog.ngocha.biz\/?p=470","title":{"rendered":"Git Commit Standards for Infrastructure Code"},"content":{"rendered":"<p>In this blog, you will learn practical commit standards for infrastructure code. <\/p>\n<p>This is also part of my company&#8217;s onboarding documentation for new team members.<\/p>\n<p>From day one, as soon as they start committing <a href=\"https:\/\/devopscube.com\/infrastructure-as-code-configuration-management\/\" rel=\"noreferrer\">infrastructure code<\/a> to Git, they follow these standards.<\/p>\n<blockquote><p><strong>Note: <\/strong>This is an opinionated piece focused specifically on infrastructure code, not application code. Standards may differ across organizations, but I am sharing this based on my experience.<\/p><\/blockquote>\n<h2 id=\"commit-standards\">Commit Standards<\/h2>\n<p>Usually, when working with infrastructure code, you pick tasks from Jira or other tools. These tasks may come from your own team or as tickets created by different teams.<\/p>\n<p>In either case, a basic commit standard should include the task ID, the action taken, and a brief description of the commit.<\/p>\n<pre><code>[Jira-ID][Action] - Short Description     <\/code><\/pre>\n<p>Action could be <strong>Add, Update, Change, xChange, Delete,<\/strong> etc.<\/p>\n<p>For example,<\/p>\n<ol>\n<li><strong>[Add]:<\/strong> To introduce new resources (e.g., add a <a href=\"https:\/\/devopscube.com\/aws-load-balancers\/\" rel=\"noreferrer\">load balancer<\/a>).<\/li>\n<li><strong>[Update]:<\/strong> For modifying existing resources (e.g., tweaking an EC2 instance type).<\/li>\n<li><strong>[Change]: <\/strong>For altering configurations or logic (e.g., modifying a <a href=\"https:\/\/devopscube.com\/aws-vpc-design\/\" rel=\"noreferrer\">VPC CIDR<\/a>).<\/li>\n<li><strong>[xChange]<\/strong>: For breaking changes that disrupt existing functionality (e.g., removing a legacy subnet routing table).<\/li>\n<\/ol>\n<p>Example: [CR-135][Add]<\/p>\n<p>After the <strong>&#8211; or :<\/strong>, add a brief message (50-72 characters ideally) describing what\u2019s being done.<\/p>\n<p>Avoid vague terms like &#8220;fix stuff&#8221;. Be specific.<\/p>\n<p>Few examples,<\/p>\n<ol>\n<li>[CR-135][Update] &#8211; Modify EC2 instance to t3.medium<\/li>\n<li>[CR-152][Change]: Adjust subnet CIDR to 10.0.3.0\/24<\/li>\n<li>[CR-167][Add]: New S3 bucket for logs<\/li>\n<li>[CR-189][Update] &#8211; Fix prod bucket policy #deploy-prod<\/li>\n<li>[CR-204][xChange]: Kicked out the old server, new one\u2019s the boss now<\/li>\n<\/ol>\n<p>Why task ID in commit?<\/p>\n<p>Because the task ID <strong>ties each commit directly to a specific task<\/strong> or ticket, making it easy to follow the trail from the code change back to the original purpose or requirement.<\/p>\n<p>This is especially useful in projects with multiple contributors or when you are debugging later and need to understand why a change was made<\/p>\n<div class=\"kg-card kg-callout-card kg-callout-card-blue\">\n<div class=\"kg-callout-emoji\">\ud83d\udca1<\/div>\n<div class=\"kg-callout-text\">Every organization usually has its own well-documented standards for commit practices. If you are working in a company, be sure to follow their guidelines.<\/div>\n<\/div>\n<h2 id=\"jira-git-integration\">Jira Git Integration<\/h2>\n<p>Tools like Jira offer Git integrations that allow you to <strong>track each Jira story or task through commit<\/strong> messages.<\/p>\n<p>For example, each Jira ticket (e.g., CR-145) represents a specific infrastructure change.<\/p>\n<p>When a <a href=\"https:\/\/devopscube.com\/become-devops-engineer\/\" rel=\"noreferrer\">DevOps engineer<\/a> makes code changes for that Jira ticket, they simply need to <strong>include the task ID in the commit message<\/strong> using the standard format mentioned earlier.<\/p>\n<p>By including a task ID (e.g., INFRA-123) in the commit message, Jira\u2019s integration <strong>automatically scans and links<\/strong> the commit to the corresponding story, issue, or ticket in its system.<\/p>\n<p>This enables Jira to display details such as the number of branches, commits, and pull requests (PRs) associated with each task.<\/p>\n<p>Here is an example.<\/p>\n<figure class=\"kg-card kg-image-card kg-card-hascaption\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-75-1.png\" class=\"kg-image\" alt=\"Git Jira integration for commit tracking\" loading=\"lazy\" width=\"1238\" height=\"772\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-75-1.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w1000\/2025\/03\/image-75-1.png 1000w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-75-1.png 1238w\" sizes=\"auto, (min-width: 720px) 720px\"><figcaption><span style=\"white-space: pre-wrap;\">Source: <\/span><a href=\"https:\/\/atlassianblog.wpengine.com\/?ref=devopscube.com\"><span style=\"white-space: pre-wrap;\">atlassianblog<\/span><\/a><\/figcaption><\/figure>\n<p>This makes tracking changes for specific tasks easier.<\/p>\n<p>If something goes wrong, you can <strong>quickly trace it back<\/strong> and collaborate with the DevOps engineer who made the changes.<\/p>\n<p>Over to you.<\/p>\n<p>Do you think commit standards should be mandatory in all DevOps teams?<\/p>\n<p>How does your team define commit actions?<\/p>\n<p>Comment below.<\/p>\n<hr>\n<p><strong>Ngu\u1ed3n:<\/strong> <a href=\"https:\/\/devopscube.com\/git-commit-standards-for-infrastructure-code\/\" target=\"_blank\" rel=\"noopener noreferrer\">Git Commit Standards for Infrastructure Code \u2014 DevOpsCube<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/devopscube.com\/git-commit-standards-for-infrastructure-code\/<\/p>\n","protected":false},"author":1,"featured_media":471,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-470","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=470"}],"version-history":[{"count":0,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/470\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/media\/471"}],"wp:attachment":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}