<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[DevOps IN SPACE: Git]]></title><description><![CDATA[The Latest Updates in Git]]></description><link>https://devopsguyankit.substack.com/s/git</link><image><url>https://substackcdn.com/image/fetch/$s_!K2kC!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9aa9f505-ddb8-42b5-aaf3-f25fb8290953_271x271.png</url><title>DevOps IN SPACE: Git</title><link>https://devopsguyankit.substack.com/s/git</link></image><generator>Substack</generator><lastBuildDate>Mon, 15 Jun 2026 10:05:42 GMT</lastBuildDate><atom:link href="https://devopsguyankit.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Ankit Ranjan]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[devopsguyankit@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[devopsguyankit@substack.com]]></itunes:email><itunes:name><![CDATA[Ankit Ranjan]]></itunes:name></itunes:owner><itunes:author><![CDATA[Ankit Ranjan]]></itunes:author><googleplay:owner><![CDATA[devopsguyankit@substack.com]]></googleplay:owner><googleplay:email><![CDATA[devopsguyankit@substack.com]]></googleplay:email><googleplay:author><![CDATA[Ankit Ranjan]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Git Hooks: Automate Your DevOps Workflow and Prevent Bad Commits]]></title><description><![CDATA[Struggling with broken builds, bad commits, or missed code checks? Git Hooks can automate your DevOps workflow and enforce quality before code even reaches your CI/CD pipeline.]]></description><link>https://devopsguyankit.substack.com/p/git-hooks-automate-your-devops-workflow</link><guid isPermaLink="false">https://devopsguyankit.substack.com/p/git-hooks-automate-your-devops-workflow</guid><dc:creator><![CDATA[Ankit Ranjan]]></dc:creator><pubDate>Thu, 26 Mar 2026 15:58:59 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Nirs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Nirs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Nirs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png 424w, https://substackcdn.com/image/fetch/$s_!Nirs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png 848w, https://substackcdn.com/image/fetch/$s_!Nirs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png 1272w, https://substackcdn.com/image/fetch/$s_!Nirs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Nirs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png" width="1050" height="373" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d80000bc-8a81-4aad-a623-b170005cc159_1050x373.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:373,&quot;width&quot;:1050,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!Nirs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png 424w, https://substackcdn.com/image/fetch/$s_!Nirs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png 848w, https://substackcdn.com/image/fetch/$s_!Nirs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png 1272w, https://substackcdn.com/image/fetch/$s_!Nirs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd80000bc-8a81-4aad-a623-b170005cc159_1050x373.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In today&#8217;s fast-paced software delivery landscape, maintaining code quality while shipping faster is one of the biggest challenges engineering teams faces. As applications grow in complexity and teams scale across geographies, even small inconsistencies &#8212; like poorly formatted code, missing tests, or accidental exposure of secrets &#8212; can lead to significant production issues.</p><p>This is where <strong>Git Hooks</strong> emerge as a powerful yet often underutilized capability.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://devopsguyankit.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading DevOps IN SPACE! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Git Hooks are lightweight scripts that run automatically at specific points in your development workflow such as before a commit or push, allowing you to enforce rules, automate checks, and prevent errors before they propagate downstream. Instead of relying on manual discipline or catching issues late in CI/CD pipelines, Git Hooks enable a <strong>shift-left approach</strong>, ensuring that quality, security, and consistency are embedded right at the developer&#8217;s workstation.</p><p>In this comprehensive guide, we will go beyond just &#8220;what Git Hooks are.&#8221; You&#8217;ll learn how they work, how to implement them effectively, and how to leverage them in real-world DevOps scenarios &#8212; including CI/CD integration, DevSecOps practices, and workflow optimization.</p><p><strong>What Are Git Hooks?</strong></p><p>Git Hooks are scripts that automatically run at specific points in the lifecycle of a Git operation. These scripts are triggered by events such as committing code, pushing changes, or merging branches.</p><p>They are a built-in feature of Git and exist inside every repository.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!591R!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!591R!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png 424w, https://substackcdn.com/image/fetch/$s_!591R!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png 848w, https://substackcdn.com/image/fetch/$s_!591R!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png 1272w, https://substackcdn.com/image/fetch/$s_!591R!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!591R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png" width="452" height="473" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:473,&quot;width&quot;:452,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!591R!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png 424w, https://substackcdn.com/image/fetch/$s_!591R!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png 848w, https://substackcdn.com/image/fetch/$s_!591R!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png 1272w, https://substackcdn.com/image/fetch/$s_!591R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd77f3ca0-0be6-4d4d-8cfc-3a561bc01d9e_452x473.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Location</strong></p><p>Git Hooks are stored in:</p><pre><code><code>.git/hooks/</code></code></pre><p>Inside this directory, you&#8217;ll find sample scripts like:</p><ul><li><p>pre-commit.sample</p></li><li><p>pre-push.sample</p></li><li><p>commit-msg.sample</p></li></ul><p>To activate a hook, you are simply:</p><ol><li><p>Rename it (remove .sample)</p></li><li><p>Add your logic</p></li><li><p>Make it executable</p></li></ol><p><strong>Why Git Hooks Matter in DevOps</strong></p><p>Git Hooks act as <strong>guardrails</strong> for your development workflow. Instead of relying on developers to manually follow best practices, hooks enforce them automatically.</p><p><strong>Key Benefits:</strong></p><ul><li><p>Enforce code quality standards</p></li><li><p>Prevent bad commits</p></li><li><p>Automate repetitive tasks</p></li><li><p>Improve CI/CD reliability</p></li><li><p>Shift validation left (early feedback)</p></li></ul><p>In DevOps culture, where automation is everything, Git Hooks provide a lightweight yet powerful way to reduce friction and errors.</p><p><strong>Types of Git Hooks</strong></p><p>Git Hooks are broadly divided into two categories:</p><p><strong>1. Client-Side Hooks:</strong> These run on the developer&#8217;s local machine.</p><p>Common Client-Side Hooks:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!svx5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!svx5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png 424w, https://substackcdn.com/image/fetch/$s_!svx5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png 848w, https://substackcdn.com/image/fetch/$s_!svx5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png 1272w, https://substackcdn.com/image/fetch/$s_!svx5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!svx5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png" width="475" height="205" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/de8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:205,&quot;width&quot;:475,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!svx5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png 424w, https://substackcdn.com/image/fetch/$s_!svx5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png 848w, https://substackcdn.com/image/fetch/$s_!svx5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png 1272w, https://substackcdn.com/image/fetch/$s_!svx5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde8634e2-3111-4c1c-9af1-2f75b87cb609_475x205.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><strong>Example Use Cases:</strong></p><ul><li><p>Run linting before commit</p></li><li><p>Validate commit message format</p></li><li><p>Prevent committing sensitive data</p></li></ul><p><strong>2. Server-Side Hooks</strong></p><p>These run on the remote repository server.</p><p><strong>Common Server-Side Hooks:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nxGX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nxGX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png 424w, https://substackcdn.com/image/fetch/$s_!nxGX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png 848w, https://substackcdn.com/image/fetch/$s_!nxGX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png 1272w, https://substackcdn.com/image/fetch/$s_!nxGX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nxGX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png" width="371" height="210" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1b170759-8235-47c7-9a11-24602933835d_371x210.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:210,&quot;width&quot;:371,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!nxGX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png 424w, https://substackcdn.com/image/fetch/$s_!nxGX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png 848w, https://substackcdn.com/image/fetch/$s_!nxGX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png 1272w, https://substackcdn.com/image/fetch/$s_!nxGX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b170759-8235-47c7-9a11-24602933835d_371x210.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><strong>Example Use Cases:</strong></p><ul><li><p>Enforce branch protection</p></li><li><p>Trigger CI/CD pipelines</p></li><li><p>Validate code at organization level</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GXbT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GXbT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png 424w, https://substackcdn.com/image/fetch/$s_!GXbT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png 848w, https://substackcdn.com/image/fetch/$s_!GXbT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png 1272w, https://substackcdn.com/image/fetch/$s_!GXbT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GXbT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png" width="1000" height="476" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/abef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:476,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!GXbT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png 424w, https://substackcdn.com/image/fetch/$s_!GXbT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png 848w, https://substackcdn.com/image/fetch/$s_!GXbT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png 1272w, https://substackcdn.com/image/fetch/$s_!GXbT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabef93ac-e703-4ceb-a704-5d678accc0e9_1000x476.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><p>Let&#8217;s break down what happens when a Git Hook is triggered:</p><p><strong>Example: </strong>pre-commit<strong> Hook</strong></p><ol><li><p><strong>Developer runs:</strong></p></li></ol><pre><code><code>git commit -m "Added feature"</code></code></pre><p><strong>2. Git triggers the </strong>pre-commit<strong> hook</strong></p><p>3. Hook script executes:</p><ul><li><p>Runs linting</p></li><li><p>Runs tests</p></li><li><p>Checks formatting</p></li></ul><p>4. Script returns:</p><ul><li><p>0 &#8594; Success &#8594; Commit proceeds</p></li><li><p>Non-zero &#8594; Failure &#8594; Commit blocked</p></li></ul><p><strong>Execution Flow</strong></p><pre><code><code>Developer Action &#8594; Hook Triggered &#8594; Script Runs &#8594; Exit Code &#8594; Continue/Stop</code></code></pre><blockquote><p><em>This simple mechanism gives you immense control over your workflow.</em></p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vkOm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vkOm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png 424w, https://substackcdn.com/image/fetch/$s_!vkOm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png 848w, https://substackcdn.com/image/fetch/$s_!vkOm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png 1272w, https://substackcdn.com/image/fetch/$s_!vkOm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vkOm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png" width="452" height="490" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:490,&quot;width&quot;:452,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!vkOm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png 424w, https://substackcdn.com/image/fetch/$s_!vkOm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png 848w, https://substackcdn.com/image/fetch/$s_!vkOm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png 1272w, https://substackcdn.com/image/fetch/$s_!vkOm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3bcf810-1b60-4750-a4d5-26c440baaf25_452x490.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let&#8217;s create a basic pre-commit hook.</p><p><strong>Step 1: Navigate to Hooks Directory</strong></p><pre><code><code>cd .git/hooks</code></code></pre><p><strong>Step 2: Create Hook File</strong></p><pre><code><code>touch pre-commit</code></code></pre><p><strong>Step 3: Add Script</strong></p><pre><code><code>#!/bin/sh
echo "Running pre-commit checks..."</code></code></pre><p><strong>Step 4: Make Executable</strong></p><pre><code><code>chmod +x pre-commit</code></code></pre><p><strong>Step 5: Test It</strong></p><p>Now try committing:</p><pre><code><code>git commit -m "Test commit"</code></code></pre><p>You&#8217;ll see:</p><pre><code><code>Running pre-commit checks...</code></code></pre><p>Let&#8217;s explore a practical scenario.</p><p><strong>1. Code Quality Enforcement</strong></p><p>Before code even enters your repository, you can enforce standards.</p><p><strong>Example:</strong></p><ul><li><p>Run ESLint / Flake8</p></li><li><p>Check formatting</p></li></ul><pre><code><code>npm run lint</code></code></pre><p>Result:</p><ul><li><p>No more messy or inconsistent code</p></li><li><p>Clean, maintainable repositories</p></li></ul><p><strong>2. Prevent Secrets from Being Committed</strong></p><p>One of the biggest risks in development is accidentally committing sensitive data.</p><p><strong>Example:</strong></p><ul><li><p>AWS keys</p></li><li><p>API tokens</p></li><li><p>Passwords</p></li></ul><p><strong>Using a pre-commit hook:</strong></p><pre><code><code>if grep -r "AWS_SECRET".; then
  echo "&#10060; Secret detected!"
  exit 1
fi</code></code></pre><p>Result:</p><ul><li><p>Prevent security breaches early</p></li><li><p>Strengthen DevSecOps practices</p></li></ul><p><strong>3. Automated Testing Before Push</strong></p><p>Instead of waiting for CI to fail, catch issues early.</p><pre><code><code>npm test</code></code></pre><p>Result:</p><ul><li><p>Faster feedback loop</p></li><li><p>Reduced pipeline failures</p></li></ul><p><strong>4. Commit Message Validation</strong></p><p>Standardizing commit messages improves collaboration and release automation.</p><p><strong>Example:</strong></p><p>Enforce Conventional Commits:</p><pre><code><code>feat: add login API
fix: resolve bug in payment</code></code></pre><pre><code><code>if! grep -qE "^(feat|fix|docs):" "$1"; then
  echo "Invalid commit message!"
  exit 1
fi</code></code></pre><p><strong>5. Trigger Deployments or Notifications</strong></p><p>Server-side hooks can:</p><ul><li><p>Trigger Jenkins pipelines</p></li><li><p>Deploy applications</p></li><li><p>Send Slack alerts</p></li></ul><p>Result:</p><ul><li><p>Fully automated workflows</p></li><li><p>Faster releases</p></li></ul><p><strong>Git Hooks in CI/CD Pipelines</strong></p><p>Code Write &#8594; Git Hooks &#8594; Push &#8594; CI Pipeline &#8594; Build &#8594; Test &#8594; Deploy (Pre-checks)</p><p><strong>How They Fit:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lD_e!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lD_e!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png 424w, https://substackcdn.com/image/fetch/$s_!lD_e!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png 848w, https://substackcdn.com/image/fetch/$s_!lD_e!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png 1272w, https://substackcdn.com/image/fetch/$s_!lD_e!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lD_e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png" width="686" height="590" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/036d76f7-066c-49f8-9607-34fb306037d1_686x590.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:590,&quot;width&quot;:686,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!lD_e!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png 424w, https://substackcdn.com/image/fetch/$s_!lD_e!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png 848w, https://substackcdn.com/image/fetch/$s_!lD_e!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png 1272w, https://substackcdn.com/image/fetch/$s_!lD_e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F036d76f7-066c-49f8-9607-34fb306037d1_686x590.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Shift-Left Strategy</strong></p><p>Git Hooks enable:</p><ul><li><p>Early validation</p></li><li><p>Faster debugging</p></li><li><p>Reduced CI load</p></li></ul><p>Instead of catching errors later, you prevent them at the source.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DW8i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DW8i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png 424w, https://substackcdn.com/image/fetch/$s_!DW8i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png 848w, https://substackcdn.com/image/fetch/$s_!DW8i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png 1272w, https://substackcdn.com/image/fetch/$s_!DW8i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DW8i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png" width="720" height="321" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:321,&quot;width&quot;:720,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!DW8i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png 424w, https://substackcdn.com/image/fetch/$s_!DW8i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png 848w, https://substackcdn.com/image/fetch/$s_!DW8i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png 1272w, https://substackcdn.com/image/fetch/$s_!DW8i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42ac9ed2-7d70-4bc1-838b-2e26010506d6_720x321.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Best Practices for Git Hooks</strong></p><p><strong>1. Keep Hooks Fast</strong></p><p>Slow hooks frustrate developers.</p><p>Tip:</p><ul><li><p>Run only essential checks</p></li><li><p>Avoid heavy operations</p></li></ul><p><strong>2. Share Hooks Across Teams</strong></p><p>Problem: Hooks are not version-controlled by default.</p><p><strong>Solution:</strong></p><ul><li><p>Store hooks in repo</p></li><li><p>Use tools like Husky</p></li></ul><p><strong>3. Version Control Your Hooks</strong></p><p>Use frameworks or custom scripts to distribute hooks across teams.</p><p><strong>4. Avoid Over-Engineering</strong></p><p>Don&#8217;t turn hooks into full CI systems.</p><p>Keep them:</p><ul><li><p>Lightweight</p></li><li><p>Focused</p></li></ul><p><strong>5. Combine Client + Server Hooks</strong></p><p>Client hooks:</p><ul><li><p>Improve developer experience</p></li></ul><p>Server hooks:</p><ul><li><p>Enforce compliance</p></li></ul><p><strong>Common Challenges &amp; Solutions</strong></p><p><strong>Problem: Hooks Not Shared</strong></p><p>Solution: Use tools like Husky or pre-commit framework</p><p><strong>Problem: Developers Bypass Hooks</strong></p><pre><code><code>git commit --no-verify</code></code></pre><p>Solution: Use server-side hooks for enforcement</p><p><strong>Problem: Performance Issues</strong></p><p>Solution:</p><ul><li><p>Optimize scripts</p></li><li><p>Cache results</p></li></ul><p><strong>Git Hooks vs CI/CD</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Wlvz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Wlvz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png 424w, https://substackcdn.com/image/fetch/$s_!Wlvz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png 848w, https://substackcdn.com/image/fetch/$s_!Wlvz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png 1272w, https://substackcdn.com/image/fetch/$s_!Wlvz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Wlvz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png" width="553" height="249" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:249,&quot;width&quot;:553,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article content&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article content" title="Article content" srcset="https://substackcdn.com/image/fetch/$s_!Wlvz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png 424w, https://substackcdn.com/image/fetch/$s_!Wlvz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png 848w, https://substackcdn.com/image/fetch/$s_!Wlvz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png 1272w, https://substackcdn.com/image/fetch/$s_!Wlvz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F749c216d-4e2e-4e7d-befb-6d304683fb3d_553x249.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Conclusion</strong></p><p>Git Hooks may seem like a small feature in the vast ecosystem of modern DevOps tooling, but their impact is anything but small. When implemented thoughtfully, they become a critical layer of automation that strengthens your development workflow from the very first line of code.</p><p>Throughout this guide, we explored how Git Hooks can:</p><ul><li><p>Enforce code quality and consistency</p></li><li><p>Catch issues before they reach CI/CD pipelines</p></li><li><p>Enable shift-left testing and security practices</p></li><li><p>Automate repetitive development tasks</p></li><li><p>Improve overall engineering efficiency</p></li></ul><p>The true power of Git Hooks lies in their simplicity. With just a few lines of scripting, you can introduce guardrails that prevent costly mistakes, reduce technical debt, and create a more disciplined development culture.</p><p>However, like any tool, their effectiveness depends on how you use them.</p><p>The key is to strike the right balance:</p><ul><li><p>Keep hooks lightweight and fast</p></li><li><p>Focus on high-impact validations</p></li><li><p>Combine client-side flexibility with server-side enforcement</p></li><li><p>Integrate them seamlessly with your CI/CD and DevSecOps workflows</p></li></ul><p>For DevOps engineers &#8212; especially those working with infrastructure automation tools like Terraform or cloud platforms like Azure &#8212; Git Hooks can be extended even further. From validating infrastructure code to enforcing policy-as-code, they can serve as an early checkpoint in your entire delivery pipeline.</p><blockquote><p><em><strong>Start small, iterate fast, and scale gradually.</strong></em></p></blockquote><p>Implement a simple pre-commit hook today &#8212; perhaps for linting or secret detection and observe the immediate improvement in your workflow. From there, evolve your hooks into a robust automation layer that complements your CI/CD pipelines and strengthens your DevOps maturity.</p><p>In a world where speed, quality, and security must coexist, Git Hooks offer a practical and elegant solution to bring them together.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://devopsguyankit.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading DevOps IN SPACE! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[You Will Mess Up in Git. Here’s How to Fix It Without Panic.]]></title><description><![CDATA[A practical, no-BS guide to undoing mistakes in Git &#8212; from small slip-ups to full-blown disasters.]]></description><link>https://devopsguyankit.substack.com/p/you-will-mess-up-in-git-heres-how</link><guid isPermaLink="false">https://devopsguyankit.substack.com/p/you-will-mess-up-in-git-heres-how</guid><dc:creator><![CDATA[Ankit Ranjan]]></dc:creator><pubDate>Wed, 18 Mar 2026 05:28:24 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!B-jY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aRPJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aRPJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aRPJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aRPJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aRPJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aRPJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg" width="728" height="291.2" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:240,&quot;width&quot;:600,&quot;resizeWidth&quot;:728,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Article cover image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Article cover image" title="Article cover image" srcset="https://substackcdn.com/image/fetch/$s_!aRPJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aRPJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aRPJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aRPJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ee788f7-8baf-4663-8f30-9385833b62bf_600x240.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="captioned-button-wrap" data-attrs="{&quot;url&quot;:&quot;https://substack.com/refer/ankitranjan?utm_source=substack&amp;utm_context=post&amp;utm_content=191335419&amp;utm_campaign=writer_referral_button&quot;,&quot;text&quot;:&quot;Start a Substack&quot;}" data-component-name="CaptionedButtonToDOM"><div class="preamble"><p class="cta-caption">Start writing today. Use the button below to create a Substack of your own</p></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://substack.com/refer/ankitranjan?utm_source=substack&amp;utm_context=post&amp;utm_content=191335419&amp;utm_campaign=writer_referral_button&quot;,&quot;text&quot;:&quot;Start a Substack&quot;,&quot;hasDynamicSubstitutions&quot;:false}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://substack.com/refer/ankitranjan?utm_source=substack&amp;utm_context=post&amp;utm_content=191335419&amp;utm_campaign=writer_referral_button"><span>Start a Substack</span></a></p></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://devopsguyankit.substack.com/?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share&quot;,&quot;text&quot;:&quot;Share DevOps IN SPACE&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://devopsguyankit.substack.com/?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share"><span>Share DevOps IN SPACE</span></a></p><p>Git is the backbone of modern software development, enabling developers and DevOps engineers to track changes, collaborate efficiently, and manage code history. However, even experienced developers occasionally run into situations where they need to <strong>undo a commit, recover lost work, or temporarily save unfinished changes</strong>.</p><p>This is where Git&#8217;s powerful recovery and history-management commands come into play.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://devopsguyankit.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading DevOps IN SPACE! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Commands like <strong>Git Reset, Git Revert, Git Stash, and Git Reflog</strong> provide developers with the ability to safely manage mistakes, recover deleted commits, and maintain a clean commit history. Whether you&#8217;re fixing a faulty commit, switching branches during development, or recovering work after an accidental reset, these tools are essential for maintaining productivity and code stability.</p><p>Understanding the difference between these commands is critical because each one serves a <strong>different purpose in Git workflow management</strong>:</p><ul><li><p><strong>Git Reset</strong> helps rewrite local commit history.</p></li><li><p><strong>Git Revert</strong> safely undoes commits in shared repositories.</p></li><li><p><strong>Git Stash</strong> temporarily saves work in progress.</p></li><li><p><strong>Git Reflog</strong> helps recover commits that appear lost.</p></li></ul><p>In this guide, we&#8217;ll explore each command in detail, including practical examples, real-world development scenarios, and best practices for using them safely in collaborative environments.</p><p>By the end of this article, you&#8217;ll have a clear understanding of <strong>when to use reset, revert, stash, or reflog</strong>, helping you manage Git history with confidence and avoid common mistakes.</p><h1><strong>Why Git Recovery Skills Are Important</strong></h1><p>In real-world development environments, mistakes are inevitable. You might:</p><ul><li><p>Commit incorrect code</p></li><li><p>Push broken changes to a repository</p></li><li><p>Accidentally delete commits</p></li><li><p>Need to switch branches while your work is incomplete</p></li></ul><p>Git&#8217;s recovery commands allow developers to <strong>safely undo changes without losing valuable work</strong>.</p><p>Knowing how to use these commands effectively is especially important in modern development workflows that involve:</p><ul><li><p>CI/CD pipelines</p></li><li><p>Multi-developer repositories</p></li><li><p>Feature branching strategies</p></li><li><p>Production deployments</p></li></ul><h1><strong>Understanding Git History and Commit Safety</strong></h1><p>Before diving into the commands, it&#8217;s important to understand how Git tracks changes.</p><p>Git stores project history through <strong>commits</strong>, which represent snapshots of your project at specific points in time.</p><p><strong>Three important components </strong>exist in Git:</p><ol><li><p><strong>Working Directory</strong> &#8211; The files you are currently editing</p></li><li><p><strong>Staging Area (Index)</strong> &#8211; Files prepared for the next commit</p></li><li><p><strong>Repository History</strong> &#8211; The stored commits</p></li></ol><p>Each command we&#8217;ll discuss interacts with these components differently.</p><p><strong>For example:</strong></p><ul><li><p><strong>Git Reset</strong> changes commit history.</p></li><li><p><strong>Git Revert</strong> creates a new commit that reverses changes.</p></li><li><p><strong>Git Stash</strong> temporarily saves uncommitted work.</p></li><li><p><strong>Git Reflog</strong> helps recover lost commits.</p></li></ul><h1><strong>Git Reset: Undoing Commits Locally</strong></h1><h2><strong>What is Git Reset?</strong></h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!B-jY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!B-jY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg 424w, https://substackcdn.com/image/fetch/$s_!B-jY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg 848w, https://substackcdn.com/image/fetch/$s_!B-jY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!B-jY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!B-jY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg" width="900" height="506" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:506,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!B-jY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg 424w, https://substackcdn.com/image/fetch/$s_!B-jY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg 848w, https://substackcdn.com/image/fetch/$s_!B-jY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!B-jY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F32d7c7bd-f1f1-40be-876c-89fd88f5bbed_900x506.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>git reset is used to <strong>undo commits by moving the HEAD pointer to a previous commit</strong>.</p><p>It is typically used when you want to modify or remove commits that haven&#8217;t been shared with others yet.</p><p>Because it <strong>rewrites history</strong>, it should be used carefully&#8212;especially in shared repositories.</p><h2><strong>Types of Git Reset</strong></h2><p>Git reset operates in<strong> three different modes.</strong></p><p>1. Soft Reset</p><p>A <strong>soft reset</strong> moves the HEAD pointer but keeps changes staged.</p><p><strong>Command: </strong>git reset --soft HEAD~1</p><p><strong>Effect:</strong></p><ul><li><p>Removes the last commit</p></li><li><p>Keeps all changes in the staging area</p></li></ul><p><strong>Use case:</strong></p><ul><li><p>When you want to edit the previous commit.</p></li></ul><p><strong>Example scenario:</strong></p><p>You committed code but forgot to add one file.</p><p>2. Mixed Reset (Default)</p><p>A <strong>mixed reset</strong> removes the commit and unstages the changes but keeps them in the working directory.</p><p><strong>Command</strong>: git reset --mixed HEAD~1</p><p><strong>Effect:</strong></p><ul><li><p>Removes the last commit</p></li><li><p>Changes remain in your working directory</p></li></ul><p><strong>Use case:</strong></p><ul><li><p>When you want to re-stage files differently.</p></li></ul><p>3. Hard Reset</p><p>A <strong>hard reset</strong> completely removes commits and deletes changes.</p><p><strong>Command: </strong>git reset --hard HEAD~1</p><p><strong>Effect:</strong></p><ul><li><p>Removes the commit</p></li><li><p>Deletes staged changes</p></li><li><p>Deletes working directory changes</p></li></ul><p><strong>Use case:</strong></p><ul><li><p>When you want to completely discard changes.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!M0HX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M0HX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png 424w, https://substackcdn.com/image/fetch/$s_!M0HX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png 848w, https://substackcdn.com/image/fetch/$s_!M0HX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png 1272w, https://substackcdn.com/image/fetch/$s_!M0HX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M0HX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png" width="750" height="305" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:305,&quot;width&quot;:750,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!M0HX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png 424w, https://substackcdn.com/image/fetch/$s_!M0HX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png 848w, https://substackcdn.com/image/fetch/$s_!M0HX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png 1272w, https://substackcdn.com/image/fetch/$s_!M0HX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9190e69e-956a-43c3-9dcd-b9661e8cfeed_750x305.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><blockquote><p><strong>Warning: Hard reset can permanently delete work.</strong></p></blockquote><h1><strong>Git Revert: Safely Undoing Commits</strong></h1><h2><strong>What is Git Revert?</strong></h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!b9V2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b9V2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png 424w, https://substackcdn.com/image/fetch/$s_!b9V2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png 848w, https://substackcdn.com/image/fetch/$s_!b9V2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png 1272w, https://substackcdn.com/image/fetch/$s_!b9V2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!b9V2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png" width="890" height="375" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:375,&quot;width&quot;:890,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!b9V2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png 424w, https://substackcdn.com/image/fetch/$s_!b9V2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png 848w, https://substackcdn.com/image/fetch/$s_!b9V2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png 1272w, https://substackcdn.com/image/fetch/$s_!b9V2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d6ec39a-c39b-4394-8be3-2afc62dc79a8_890x375.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>git revert creates a <strong>new commit that reverses changes made by a previous commit</strong>.</p><p>Unlike reset, it <strong>does not change commit history</strong>.</p><p>This makes it <strong>safe for shared repositories</strong>.</p><h2><strong>Git Revert Example</strong></h2><p>Suppose a commit introduced a bug.</p><p>You can <strong>revert </strong>it using: -   git revert &lt;commit-id&gt;</p><p><strong>Git will:</strong></p><ol><li><p>Create a new commit</p></li><li><p>Apply the opposite changes of the specified commit</p></li></ol><h2><strong>Reverting Multiple Commits</strong></h2><p>You can revert multiple commits as well.</p><p><strong>Example</strong>: git revert HEAD~3..HEAD</p><p>This command reverts the last three commits.</p><h2><strong>When Should You Use Git Revert?</strong></h2><p><strong>Use revert when:</strong></p><ul><li><p>The commit has already been pushed</p></li><li><p>Other developers may have pulled the changes</p></li><li><p>You want to maintain a transparent commit history</p></li></ul><p><strong>Example scenarios:</strong></p><ul><li><p>Production bug rollback</p></li><li><p>Undoing faulty merge commits</p></li><li><p>Reversing incorrect configuration changes</p></li></ul><h1><strong>Git Stash: Saving Work in Progress</strong></h1><h2><strong>What is Git Stash?</strong></h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!s8Zf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!s8Zf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg 424w, https://substackcdn.com/image/fetch/$s_!s8Zf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg 848w, https://substackcdn.com/image/fetch/$s_!s8Zf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!s8Zf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!s8Zf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg" width="900" height="492" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:492,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!s8Zf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg 424w, https://substackcdn.com/image/fetch/$s_!s8Zf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg 848w, https://substackcdn.com/image/fetch/$s_!s8Zf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!s8Zf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feaaf795f-fae5-4a05-b1d2-91a28c33274a_900x492.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Sometimes you need to switch branches, but your work is incomplete.</p><p>git stash temporarily saves your changes so you can return to a clean working directory.</p><p>It&#8217;s like putting your current work <strong>on a temporary shelf</strong>.</p><h2><strong>Basic Git Stash Command</strong></h2><p>git stash</p><p>This command:</p><ul><li><p>Saves your working changes</p></li><li><p>Restores the working directory to the last commit state</p></li></ul><h2><strong>Viewing Stashed Changes</strong></h2><p>You can<strong> view saved stashes using</strong>: git stash list</p><p><strong>Example output:</strong></p><p>stash@{0}: WIP on feature-login<br>stash@{1}: WIP on payment-module</p><h2><strong>Applying a Stash</strong></h2><p>To restore a stash:</p><p>git stash apply</p><p>This applies the latest stash without removing it.</p><h2><strong>Applying and Removing a Stash</strong></h2><p>git stash pop</p><p>This command:</p><ul><li><p>Applies the stash</p></li><li><p>Removes it from the stash list</p></li></ul><h2><strong>Naming a Stash</strong></h2><p><strong>For better organization, you can name your stash.</strong></p><p><strong>Example:</strong></p><p>git stash push -m &#8220;Work in progress on login feature&#8221;</p><h2><strong>When Should You Use Git Stash?</strong></h2><p>Common scenarios include:</p><ul><li><p>Switching branches to fix urgent bugs</p></li><li><p>Pulling updates before finishing current work</p></li><li><p>Temporarily saving incomplete changes</p></li></ul><h1><strong>Git Reflog: Recovering Lost Commits</strong></h1><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BhRR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BhRR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg 424w, https://substackcdn.com/image/fetch/$s_!BhRR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg 848w, https://substackcdn.com/image/fetch/$s_!BhRR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!BhRR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BhRR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg" width="900" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!BhRR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg 424w, https://substackcdn.com/image/fetch/$s_!BhRR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg 848w, https://substackcdn.com/image/fetch/$s_!BhRR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!BhRR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F85d0a593-c712-4e33-8c73-2abb55dc3742_900x600.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2><strong>What is Git Reflog?</strong></h2><p>git reflog is one of Git&#8217;s most powerful recovery tools.</p><p>It records <strong>every movement of the HEAD pointer</strong>, including:</p><ul><li><p>Commits</p></li><li><p>Resets</p></li><li><p>Checkouts</p></li><li><p>Rebases</p></li></ul><p>Even if a commit is removed from history, reflog can still help recover it.</p><h2><strong>Viewing Reflog</strong></h2><p><strong>Command: </strong>git reflog</p><p><strong>Example output:</strong></p><p>a1b2c3 HEAD@{0}: reset: moving to HEAD~1<br>d4e5f6 HEAD@{1}: commit: added login feature<br>g7h8i9 HEAD@{2}: checkout: moving to main</p><h2><strong>Recovering a Lost Commit</strong></h2><p>Suppose you accidentally ran: - git reset --hard HEAD~1</p><p><strong>Your commit appears lost. </strong></p><p>You can recover it using reflog.</p><p>Step 1: Find the commit in reflog.</p><p>git reflog</p><p>Step 2: Restore the commit.</p><p>git reset --hard &lt;commit-id&gt;</p><p>Your work is restored.</p><h2><strong>Real-World Recovery Scenarios</strong></h2><p>Git reflog is extremely useful when:</p><ul><li><p>A branch was accidentally deleted</p></li><li><p>Hard reset removed commits</p></li><li><p>Rebase caused loss of changes</p></li><li><p>Commit history was rewritten</p></li></ul><blockquote><p>It acts as a <strong>safety net for Git history mistakes</strong>.</p></blockquote><h1><strong>Git Reset vs Revert vs Stash vs Reflog</strong></h1><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!joSr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!joSr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg 424w, https://substackcdn.com/image/fetch/$s_!joSr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg 848w, https://substackcdn.com/image/fetch/$s_!joSr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!joSr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!joSr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg" width="900" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!joSr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg 424w, https://substackcdn.com/image/fetch/$s_!joSr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg 848w, https://substackcdn.com/image/fetch/$s_!joSr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!joSr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bd6c5ae-e35c-4693-8c59-907c8b34cc9d_900x600.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oRpN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oRpN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png 424w, https://substackcdn.com/image/fetch/$s_!oRpN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png 848w, https://substackcdn.com/image/fetch/$s_!oRpN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png 1272w, https://substackcdn.com/image/fetch/$s_!oRpN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oRpN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png" width="718" height="265.0031545741325" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:234,&quot;width&quot;:634,&quot;resizeWidth&quot;:718,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!oRpN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png 424w, https://substackcdn.com/image/fetch/$s_!oRpN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png 848w, https://substackcdn.com/image/fetch/$s_!oRpN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png 1272w, https://substackcdn.com/image/fetch/$s_!oRpN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dd1a1a1-a65f-415b-98e1-1de797d0086e_634x234.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Quick summary:</p><ul><li><p><strong>Reset</strong> rewrites history.</p></li><li><p><strong>Revert</strong> safely undoes commits.</p></li><li><p><strong>Stash</strong> temporarily saves work.</p></li><li><p><strong>Reflog</strong> recovers lost history.</p></li></ul><h1><strong>Best Practices for Managing Git History</strong></h1><p>To avoid major issues while working with Git, follow these best practices.</p><p>Avoid Hard Reset on Shared Branches</p><p><strong>Running</strong>: git reset --hard</p><p>on a shared branch can disrupt teammates&#8217; work.</p><p>Use Revert for Public Commits</p><p>If a commit has already been pushed, <strong>prefer</strong>: git revert</p><p>instead of reset.</p><p>Use Stash Before Switching Context</p><p>Before switching branches, stash unfinished work.</p><p>This prevents merge conflicts and lost changes.</p><p>Use Reflog as a Recovery Tool</p><p>If you ever think your work is lost, <strong>run: -</strong>git reflog</p><p>Chances are, Git still remembers the commit.</p><h1><strong>Conclusion</strong></h1><p>Git provides powerful tools not only for tracking changes but also for <strong>recovering from mistakes and managing code history effectively</strong>. Commands like <strong>Git Reset, Git Revert, Git Stash, and Git Reflog</strong> form an essential safety net for developers working in fast-paced development environments.</p><p>Each command plays a specific role in handling different scenarios:</p><ul><li><p><strong>Git Reset</strong> is useful for rewriting local history before sharing commits.</p></li><li><p><strong>Git Revert</strong> provides a safe way to undo changes in shared repositories without altering commit history.</p></li><li><p><strong>Git Stash</strong> helps developers temporarily store unfinished work when switching tasks or branches.</p></li><li><p><strong>Git Reflog</strong> acts as a powerful recovery tool that can restore commits even after accidental resets or rebases.</p></li></ul><p>Mastering these commands not only improves your Git workflow but also increases confidence when working with complex repositories, CI/CD pipelines, and collaborative development teams.</p><p>For developers and DevOps engineers, understanding these recovery mechanisms can mean the difference between <strong>losing hours of work and recovering it in seconds</strong>.</p><p>As you continue working with Git, practicing these commands in real scenarios will help you build stronger version control skills and maintain cleaner, safer commit histories.</p><p>If you want to become truly proficient with Git, learning how to <strong>recover, revert, and manage history effectively</strong> is just as important as committing code.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://devopsguyankit.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading DevOps IN SPACE! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Git Pull vs Git Fetch ]]></title><description><![CDATA[The Subtle Difference That Saves Production]]></description><link>https://devopsguyankit.substack.com/p/git-pull-vs-git-fetch</link><guid isPermaLink="false">https://devopsguyankit.substack.com/p/git-pull-vs-git-fetch</guid><dc:creator><![CDATA[Ankit Ranjan]]></dc:creator><pubDate>Thu, 19 Feb 2026 05:32:26 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!dPMb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most developers learn Git commands early in their careers.</p><p>But very few truly understand the difference between:</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://devopsguyankit.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><pre><code><code>git pull
git fetch
</code></code></pre><p>And that small misunderstanding?</p><p>It&#8217;s responsible for countless merge conflicts, broken branches, and unstable CI pipelines.</p><p>Let&#8217;s fix that: - </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dPMb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dPMb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png 424w, https://substackcdn.com/image/fetch/$s_!dPMb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png 848w, https://substackcdn.com/image/fetch/$s_!dPMb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png 1272w, https://substackcdn.com/image/fetch/$s_!dPMb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dPMb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png" width="1050" height="459" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:459,&quot;width&quot;:1050,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dPMb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png 424w, https://substackcdn.com/image/fetch/$s_!dPMb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png 848w, https://substackcdn.com/image/fetch/$s_!dPMb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png 1272w, https://substackcdn.com/image/fetch/$s_!dPMb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4bb7c4-46f5-4a73-86cc-773798cd3e89_1050x459.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>What <code>git fetch</code> Actually Does</h2><p>When you run:</p><pre><code><code>git fetch origin
</code></code></pre><p>Git:</p><ul><li><p>Downloads new commits from the remote repository</p></li><li><p>Updates your remote-tracking branches (<code>origin/main</code>)</p></li><li><p>Does NOT touch your current working branch</p></li></ul><p>Your code stays exactly the same.</p><p>Think of it as:</p><blockquote><p>&#8220;Let me see what changed before I touch anything.&#8221;</p></blockquote><p>This makes <code>git fetch</code> ideal for:</p><ul><li><p>Reviewing teammate changes</p></li><li><p>Safe DevOps workflows</p></li><li><p>Production-sensitive branches</p></li><li><p>Controlled merge strategies</p></li></ul><h2>What <code>git pull</code> Actually Does</h2><p>When you run:</p><pre><code><code>git pull origin main
</code></code></pre><p>Git performs:</p><ol><li><p><code>git fetch</code></p></li><li><p><code>git merge</code> (or rebase if configured)</p></li></ol><p>This means:</p><ul><li><p>Your local branch changes immediately</p></li><li><p>Merge commits may be created</p></li><li><p>Conflicts can appear instantly</p></li></ul><p>Think of it as:</p><blockquote><p>&#8220;Bring everything in and merge it now.&#8221;</p></blockquote><p>That&#8217;s fast &#8212; but not always safe.</p><h2>Why This Matters in DevOps</h2><p>In real-world CI/CD environments, surprises are expensive.</p><p>Many experienced teams prefer:</p><pre><code><code>git fetch
git diff origin/main
git merge origin/main
</code></code></pre><p>Why?</p><p>Because visibility before integration = fewer broken builds.</p><p>This is especially important when:</p><ul><li><p>Working with multiple contributors</p></li><li><p>Managing protected branches</p></li><li><p>Deploying via automated pipelines</p></li><li><p>Handling microservices architecture</p></li></ul><p>Small discipline in Git usage creates massive stability downstream.</p><h2>When to Use What</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VnVM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VnVM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png 424w, https://substackcdn.com/image/fetch/$s_!VnVM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png 848w, https://substackcdn.com/image/fetch/$s_!VnVM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png 1272w, https://substackcdn.com/image/fetch/$s_!VnVM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VnVM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png" width="746" height="365" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:365,&quot;width&quot;:746,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31758,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://devopsguyankit.substack.com/i/188459788?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VnVM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png 424w, https://substackcdn.com/image/fetch/$s_!VnVM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png 848w, https://substackcdn.com/image/fetch/$s_!VnVM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png 1272w, https://substackcdn.com/image/fetch/$s_!VnVM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68c32386-a5fa-49b0-a341-d5512927ff3f_746x365.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>The Mindset Shift</h2><p>The real difference isn&#8217;t technical.</p><p>It&#8217;s psychological.</p><p><code>git fetch</code> = Intentional workflow<br><code>git pull</code> = Convenience workflow</p><p>Mature engineering teams optimize for control, not convenience.</p><p>If you&#8217;re serious about improving your Git workflow as a Developer or DevOps Engineer, mastering this distinction is foundational.</p><p>I wrote a more detailed practical guide with examples here:</p><p><strong>Read the full breakdown:</strong><br> <a href="https://medium.com/towards-aws/git-pull-vs-git-fetch-a-practical-guide-for-developers-and-devops-engineers-cc6766d68e6d">https://medium.com/towards-aws/git-pull-vs-git-fetch-a-practical-guide-for-developers-and-devops-engineers-cc6766d68e6d</a></p><p>If you enjoyed this, consider subscribing.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://devopsguyankit.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>