<?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>David Underhill &#187; version control</title>
	<atom:link href="http://dound.com/category/version-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://dound.com</link>
	<description>dound&#039;s space on the web</description>
	<lastBuildDate>Tue, 31 Jan 2012 10:57:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>github: Send e-mail on push</title>
		<link>http://dound.com/2009/05/github-send-e-mail-on-push/</link>
		<comments>http://dound.com/2009/05/github-send-e-mail-on-push/#comments</comments>
		<pubDate>Sun, 31 May 2009 13:56:37 +0000</pubDate>
		<dc:creator>David Underhill</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[version control]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[post-receive]]></category>

		<guid isPermaLink="false">http://dound.com/?p=176</guid>
		<description><![CDATA[I&#8217;ve been looking for a way to have github, my favorite repository hosting service, send emails to interested parties whenever someone pushes new commits into the repository, They don&#8217;t seem to provide this service directly, but they do provide both an API for programatically querying the site as well as post-receive callbacks. The latter sends [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for a way to have <a href="https://github.com/">github</a>, my favorite repository hosting service, send emails to interested parties whenever someone pushes new commits into the repository,  They don&#8217;t seem to provide this service directly, but they do provide both an <a href="http://develop.github.com/">API</a> for programatically querying the site as well as <a href="http://www.kernel.org/pub/software/scm/git/docs/githooks.html">post-receive</a> callbacks.  The latter sends a POST request to URL(s) of your choice.  The POST request includes <a href="http://www.json.org/">JSON</a> data which contains information about the repository and the new commits (for details, <a href="http://github.com/guides/post-receive-hooks">see here</a>).  Using this, I was able to put together a relatively simple <a href="http://www.php.net/">PHP</a> script which repackages this information into a human-readable form and sends it off in an email (<b><a href="https://github.com/dound/github-post-receive-php-handler/tree">source code here</a></b>).</p>
<p>I wanted to use the github API to get a list of those who watch the project, and then send an email to those people.  Unfortunately the API does not let you query that yet.  Instead, my script lets you specify the recipients manually.  Alternatively, a simple mailing list implementation is provided so people can sign up for the post-receive emails through a webpage instead.</p>
<p>The only downside is that the JSON github provides does not include information about how many lines were modified, just files.  In this respect, <a href="http://git.kernel.org/?p=git/git.git;a=history;f=contrib/hooks/post-receive-email">Andy Parkin&#8217;s post-receive</a> script produces slightly more informative e-mails (but of course it doesn&#8217;t work with github).</p>
]]></content:encoded>
			<wfw:commentRss>http://dound.com/2009/05/github-send-e-mail-on-push/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>git: forever remove files or folders from history</title>
		<link>http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/</link>
		<comments>http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 23:39:23 +0000</pubDate>
		<dc:creator>David Underhill</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[version control]]></category>
		<category><![CDATA[binary file]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[repository]]></category>

		<guid isPermaLink="false">http://dound.com/?p=132</guid>
		<description><![CDATA[I recently had a need to rewrite a git repository&#8217;s history. This isn&#8217;t generally a very good idea, though it is useful if your repository contains files it should not (such as unneeded large binary files or copyrighted material). I also am using it because I had a branch where I only wanted to merge [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a need to rewrite a <a href="http://git-scm.com/">git</a> repository&#8217;s history.  This isn&#8217;t generally a very good idea, though it is useful if your repository contains files it should not (such as unneeded large binary files or copyrighted material).  I also am using it because I had a branch where I only wanted to merge a subset of files back into master (though there are probably better ways of doing this).  Anyway, it is not very hard to rewrite history thanks to the excellent <a href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a> tool which comes with <a href="http://git-scm.com/">git</a>.  However, if your goal was to reduce a large repository&#8217;s size then <a href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a> does not quite finish the job since it makes temporary backups of the filtered out files.  To remove those, you need to do a little more work.  To make it easier to permanently remove files, I wrapped it in a little bash script <a href="http://dound.com/wp/files/git-remove-history">git-remove-history</a> (also shown below) &#8212; simply go to the root of your repository and run the script with the list of files you want to delete and it will do the rest.  There is an interesting thread about doing this <a href="http://kerneltrap.org/mailarchive/git/2007/10/7/331471">here</a> on <a href="http://kerneltrap.org/">KernelTrap</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-o</span> errexit
&nbsp;
<span style="color: #666666; font-style: italic;"># Author: David Underhill</span>
<span style="color: #666666; font-style: italic;"># Script to permanently delete files/folders from your git repository.  To use </span>
<span style="color: #666666; font-style: italic;"># it, cd to your repository's root and then run the script with a list of paths</span>
<span style="color: #666666; font-style: italic;"># you want to delete, e.g., git-delete-history path1 path2</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># make sure we're at the root of git repo</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> .git <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error: must run this script from the root of a git repository&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># remove all paths passed as arguments from the history of the repo</span>
<span style="color: #007800;">files</span>=$<span style="color: #000000; font-weight: bold;">@</span>
git filter-branch <span style="color: #660033;">--index-filter</span> <span style="color: #ff0000;">&quot;git rm -rf --cached --ignore-unmatch <span style="color: #007800;">$files</span>&quot;</span> HEAD
&nbsp;
<span style="color: #666666; font-style: italic;"># remove the temporary history git-filter-branch otherwise leaves behind for a long time</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> .git<span style="color: #000000; font-weight: bold;">/</span>refs<span style="color: #000000; font-weight: bold;">/</span>original<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> git reflog expire <span style="color: #660033;">--all</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span>  git <span style="color: #c20cb9; font-weight: bold;">gc</span> <span style="color: #660033;">--aggressive</span> <span style="color: #660033;">--prune</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
	</channel>
</rss>

