<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maks Yadvinskyy</title>
    <description>The latest articles on DEV Community by Maks Yadvinskyy (@maks_yadvinskyy).</description>
    <link>https://dev.to/maks_yadvinskyy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F172700%2Fe4a4ff19-a07a-4cbb-ad7f-1ccf4195d13e.JPG</url>
      <title>DEV Community: Maks Yadvinskyy</title>
      <link>https://dev.to/maks_yadvinskyy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maks_yadvinskyy"/>
    <language>en</language>
    <item>
      <title>Git Holiday Cleanup 🌲</title>
      <dc:creator>Maks Yadvinskyy</dc:creator>
      <pubDate>Fri, 11 Dec 2020 17:14:34 +0000</pubDate>
      <link>https://dev.to/maks_yadvinskyy/git-holiday-local-cleanup-3ihe</link>
      <guid>https://dev.to/maks_yadvinskyy/git-holiday-local-cleanup-3ihe</guid>
      <description>&lt;p&gt;The year is almost over and the holidays are approaching, what a good time to say goodbye to your old stale branches. I know letting go of something is always hard, but don't sweat it. I'll teach you how to keep the things you need and &lt;del&gt;remove&lt;/del&gt; purge the rest.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 1
&lt;/h5&gt;

&lt;p&gt;Get a list of my local branches&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; git_branches.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 2
&lt;/h5&gt;

&lt;p&gt;In the editor mark the branches that you want to keep&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;123-branch-to-remove
&lt;span class="k"&gt;*&lt;/span&gt; master
&lt;span class="k"&gt;*&lt;/span&gt; dev
&lt;span class="k"&gt;*&lt;/span&gt; keep-branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 3
&lt;/h5&gt;

&lt;p&gt;Run the command bellow to verify the branches you want gone&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;git_branches.txt | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"^[^&lt;/span&gt;&lt;span class="se"&gt;\*&lt;/span&gt;&lt;span class="s2"&gt;].*"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 4
&lt;/h5&gt;

&lt;p&gt;If they are all good then run the same command and feed it into &lt;code&gt;git branch -D&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat git_branches.txt | grep "^[^\*].*" | xargs git branch -D
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Step 5
&lt;/h5&gt;

&lt;p&gt;Enjoy the holidays, show this to your colleagues and be nice! &lt;/p&gt;

</description>
      <category>git</category>
      <category>branch</category>
      <category>delete</category>
      <category>unix</category>
    </item>
  </channel>
</rss>
