{"componentChunkName":"component---src-templates-blog-post-js","path":"/how-to-delete-local-or-remote-branch-in-git/","result":{"data":{"site":{"siteMetadata":{"title":"ngtan","author":"Tan Nguyen"}},"markdownRemark":{"id":"72dc9623-cc13-5dce-bed9-101c050ed13b","excerpt":"Deletes a local branch Shorthand  Force a branch to be deleted even if it hasn’t been pushed or merged yet. Delete all branches but keeping others like “develop…","html":"<h3>Deletes a local branch</h3>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">  git branch --delete &lt;branch-name&gt;</code></pre></div>\n<p>Shorthand </p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">  git branch -d &lt;branch-name&gt;</code></pre></div>\n<p>Force a branch to be deleted even if it hasn’t been pushed or merged yet.</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">  git branch -D &lt;branch-name&gt;</code></pre></div>\n<p>Delete all branches but keeping others like “develop”, “master”</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">  git branch | grep -v &quot;develop&quot; | grep -v &quot;master&quot; | xargs git branch -D</code></pre></div>\n<h3>Deletes a remote branch</h3>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">  git push origin --delete &lt;branch-name&gt;</code></pre></div>\n<h3>Conclusion</h3>\n<p>Have fun and stay tuned for the next post. Thanks for reading 😉</p>","timeToRead":1,"frontmatter":{"title":"How to delete a local or remote branch in Git","date":"June 11, 2020"}}},"pageContext":{"slug":"/how-to-delete-local-or-remote-branch-in-git/","previous":{"fields":{"slug":"/singapore-malaysia-journey/"},"frontmatter":{"title":"Singapore & Malaysia Journey"}},"next":null}}}