<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Irish &#124; Ruby, Rails, Javascript Developer &#124; Phoenix, AZ &#187; Git</title>
	<atom:link href="http://www.christopherirish.com/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.christopherirish.com</link>
	<description>Ruby, Rails, Javascript, all things web development related</description>
	<lastBuildDate>Mon, 19 Jan 2026 07:43:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Git garbage collect bash script</title>
		<link>http://www.christopherirish.com/2010/05/03/git-garbage-collect-bash-script/</link>
		<comments>http://www.christopherirish.com/2010/05/03/git-garbage-collect-bash-script/#comments</comments>
		<pubDate>Mon, 03 May 2010 15:00:08 +0000</pubDate>
		<dc:creator>Irish</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://www.christopherirish.com/?p=183</guid>
		<description><![CDATA[The following shell command will crawl your hard drive, from your current directory, looking for any git repositories. When it finds them it will garbage collect, prune, and pack them, regaining your disk space and make your repositories operate faster. 12#!/bin/sh find . -type d -name .git &#124; while read dir; do pushd &#34;$dir&#34;; git [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>The following shell command will crawl your hard drive, from your current directory, looking for any git repositories.  When it finds them it will garbage collect, prune, and pack them, regaining your disk space and make your repositories operate faster.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> d <span style="color: #660033;">-name</span> .git <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #c20cb9; font-weight: bold;">dir</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">pushd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$dir</span>&quot;</span>; <span style="color: #c20cb9; font-weight: bold;">git gc</span> <span style="color: #660033;">--prune</span>; <span style="color: #7a0874; font-weight: bold;">popd</span>; <span style="color: #000000; font-weight: bold;">done</span></div></td></tr></tbody></table></div>
<p>You can run this directly from the terminal or just turn this snippet into a lil bash script file for easy executing later, i.e.</p>

<div class="wp-terminal">$ touch git_garbage_collect.sh<br/>$ nano git_garbage_collect.sh<br/>$ # copy & paste the script into the file<br/>$ ctrl+o # to save the file<br/>$ ctrl+x # to exit nano<br/></div>

<p>Then just run it like any other bash script</p>

<div class="wp-terminal">$ ./git_garbage_collect.sh<br/></div>

<div id="hire" class="text-center">
  <a href="http://velocitylabs.io"><img src="http://www.christopherirish.com/wp-content/uploads/2018/07/velocity-labs-logo-text.png" alt="" title="velocity-labs-logo-text" width="300" class="alignleft size-full wp-image-971" /></a></p>
<p>
    Need web application development, maintenance for your existing app, or a third party code review?
  </p>
<p>
    <strong class="text-uppercase">Velocity Labs can help.</strong>
  </p>
<p>  <a href="http://velocitylabs.io#contact" class="btn btn-warning btn-block" target="_blank">Click here to get started!</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.christopherirish.com/2010/05/03/git-garbage-collect-bash-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
