<?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>Abizern.org &#187; diff</title>
	<atom:link href="http://abizern.org/tag/diff/feed/" rel="self" type="application/rss+xml" />
	<link>http://abizern.org</link>
	<description>The personal and developer blog of a Mac developer in London.</description>
	<lastBuildDate>Sun, 09 Oct 2011 19:06:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Integrating git with SubEthaEdit and Changes.app</title>
		<link>http://abizern.org/2009/11/08/integrating-git-with-subethaedit-and-changes/</link>
		<comments>http://abizern.org/2009/11/08/integrating-git-with-subethaedit-and-changes/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 16:41:02 +0000</pubDate>
		<dc:creator>Abizer</dc:creator>
				<category><![CDATA[Mac Development]]></category>
		<category><![CDATA[changes_app]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[subethaedit]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.stompy.org/?p=160</guid>
		<description><![CDATA[A while ago, I read a nice write up about using mercurial with SubEthaEdit and Changes. Here&#8217;s how to do the same thing with git instead of mercurial, separated into two parts in case you just want to apply one set of changes. Changes Support Step One: Make sure chdiff is installed. Open Changes.app and [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, I read a <a href="http://schinckel.net/2008/04/26/mercurial-with-os-x-gui-tools/">nice write up</a> about using <a href="http://mercurial.selenic.com/">mercurial</a> with <a href="http://www.codingmonkeys.de/subethaedit/" title="Text editor from the Coding Monkeys">SubEthaEdit</a> and <a href="http://connectedflow.com/changes/" title="Diff viewer from Connected Flow">Changes</a>. Here&#8217;s how to do the same thing with <a href="http://git-scm.com/" title="Distributed Version Control System">git</a> instead of <a href="http://mercurial.selenic.com/">mercurial</a>, separated into two parts in case you just want to apply one set of changes.</p>
<h2>Changes Support</h2>
<p><strong>Step One: Make sure chdiff is installed.</strong></p>
<p>Open Changes.app and from the Changes menu select &#8220;Install terminal utility&#8221;. This will install the chdiff utility which is used by the script.
<p><strong>Step Two: Create a shell script to send diffs to Changes</strong>
<p>Create a shell script with the following contents.</p>
<div class="code"><span style="color:#236e25;"><em>#!/bin/sh<br />
</em></span>[ <span style="color:#c4620a;">$#</span> -eq <span style="color:#0000ff;">7</span> ] &amp;&amp; /usr/bin/env chdiff <span style="color:#760f15;">&quot;</span><span style="color:#c4620a;">$2</span><span style="color:#760f15;">&quot;</span> <span style="color:#760f15;">&quot;</span><span style="color:#c4620a;">$5</span><span style="color:#760f15;">&quot;</span></div>
<p>Where you save this and what you call it is up to you. Mine is called &#8216;.gitchanges&#8217;, saved it at the root of my home directory. Make sure the script is executable.</p>
<p><strong>Step Three: Edit the .gitconfig file to use this script to handle diffs.</strong></p>
<p>Open your <code>~/.gitconfig</code> file. This should already exist, at the very least it will contain you name and email. under the section called <code>[diff]</code> add the location and name of the file.  You may have to edit this to make sure it points to the name and location you chose in Step Two. (Make sure to use the correct path in your setup)</p>
<div class="code"><span style="color:#dd0000;">[</span><span style="color:#003369;">diff</span><span style="color:#dd0000;">]</span><br />
external = <span style="color:#881280;">&lt;path to file&gt;</span>/.gitchanges</div>
<h2>SubEthaEdit Support</h2>
<p><strong>Step One: Download and install the mode file for SubEthaEdit</strong>
</p>
<p>I wrote a SubEthaEdit mode for this which you can download from the <a href="http://abizern.github.com/gitcommit.mode/" title="GitHub Project page">github project page</a>. Please feel free to fork it and send me patches.</p>
<p><strong>Step Two: Edit the .gitconfig file to use SebEthaEdit as an external editor.</strong></p>
<p>Open your <code>~/.gitconfig</code> file. This time, under the <code>[core]</code> section, add the following line:</p>
<div class="code"><span style="color:#dd0000;">[</span><span style="color:#003369;">core</span><span style="color:#dd0000;">]</span><br />
editor = /usr/bin/see -w -r -o new-window -j &#8216;git editor&#8217; -m gitCommit -g 1:0</div>
<p>All those flags may seem daunting, but they are quite self-explanatory: the <code>-w</code> flag makes the Terminal wait for a response from SubEthaEdit. <code>-r</code> brings Terminal to the front after you&#8217;re done editing. <code>-o new-window</code> opens a new window for editing. I prefer this to having a new tab appear in whatever window I was working on. <code>-j 'git editor</code>&#8216; this sets the text that appears in the title bar, which you can change as you wish. <code>-m gitCommit</code> is what sets the mode to be used for editing. and <code>-g 1:0</code> puts the caret at the beginning of the file.</p>
<p>Now, when git asks you to write a commit message, or pick commits when running <code>git rebase -i</code> a SubEthaEdit window will open as the commit message editor. Make whatever changes you need then save the file (⌘-s) and then close the window (⌘-w) for these changes to take effect.</p>
]]></content:encoded>
			<wfw:commentRss>http://abizern.org/2009/11/08/integrating-git-with-subethaedit-and-changes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

