<?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>Educate. Liberate. &#187; git</title>
	<atom:link href="http://www.nullstyle.com/category/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nullstyle.com</link>
	<description></description>
	<lastBuildDate>Mon, 10 Nov 2008 05:33:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Create custom commands in Git</title>
		<link>http://www.nullstyle.com/2007/06/22/create-custom-commands-in-git/</link>
		<comments>http://www.nullstyle.com/2007/06/22/create-custom-commands-in-git/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 17:54:53 +0000</pubDate>
		<dc:creator>nullstyle</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[scm]]></category>

		<guid isPermaLink="false">http://nullstyle.com/2007/09/29/create-custom-commands-in-git/</guid>
		<description><![CDATA[Let me explain a bit about Git before I get into the subject of this post. click hear if you don&#8217;t want to read my opinion on Git Git is a wonderful thing. It&#8217;s fast, provides a great speed boost, and it&#8217;s quick. It does merging like I want an SCM to do. Git is [...]]]></description>
			<content:encoded><![CDATA[<p>Let me explain a bit about Git before I get into the subject of this post.  <a href="#meat">click hear if you don&#8217;t want to read my opinion on Git</a></p>

<p><a href="http://git.or.cz/">Git</a> is a wonderful thing.  It&#8217;s fast, provides a great speed boost, and it&#8217;s quick.  It does merging like I want an <a href="http://en.wikipedia.org/wiki/Source_Code_Management">SCM</a> to do.</p>

<p>Git is also a terrible thing (for me).  It discards most of the command knowledge I have accumulated with <a href="http://subversion.tigris.org/" title="subversion.tigris.org">SVN</a>, or even <a href="http://www.selenic.com/mercurial/wiki/">Mercurial</a> (my previous DSCM of choice), and sometimes replaces that knowledge with poorly exposed commands or completely different concepts.  An example of the latter would be the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-revert.html">git-revert</a> command how it compares to the <a href="http://svnbook.red-bean.com/en/1.1/re25.html">svn revert</a> command.  That isn&#8217;t so much of a big deal since Git doesn&#8217;t (and shouldn&#8217;t) let the decisions of a separate project dictate its interface; that said, it doesn&#8217;t change the fact that 95% of Git new adopters will be coming from an environment where revert undoes your currently uncommited changes.</p>

<p>The former is more troubling, but thankfully being worked upon.  The analog to <code>svn revert</code> is <code>git-checkout -f</code>.  I think that this is mostly confusing when perusing the man page, I thought to myself &#8220;Hey, there is git-reset, git-revert, there has to be some other command here like that that undoes my uncommitted changes&#8221;. The point is that common operations are not so easily learned in the git workflow.  There are some good docs such as <a href="http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html">Everyday Git</a>, but in general the learning process is somewhat painful for Git. Luckily&#8230;
<h4 id="meat">Extending git</h4>
Git is made up of a hundred or so tiny applications, that are easily chained together to compose custom functionality.  These applications expose functionality at high (end-user) level, and more interestingly at a very low-level.   An example would be <a href="http://repo.or.cz/w/git-knacks.git">git-knacks</a> that I hacked together yesterday evening in 20 minutes.  They provide an easy way to shelve and unshelve code that isn&#8217;t ready for a real commit.  More on that later&#8230;</p>

<p>What I didn&#8217;t know, though, was that the <code>git</code> command uses a simple naming convention for sub commands that you can use to inject functionality into the <code>git</code> command for others t use.  <code>git reset</code> executes <code>git-reset</code> and <code>git checkout-index</code> runs <code>git-checkout-index</code>.  All you have to do is write your own commands in whatever language you choose, name it properly, and presto&#8230; <code>git hello-world</code> is now in your toolchain.</p>

<p>I had thought the <code>git-</code> commands where simply for tab-completion support, and were just aliases into the &#8220;git blah&#8221; style commands.  I was exactly oppositely wrong.</p>

<p>The unix-way got me to switch from Mercurial.  Sure, I can write scripts that call to the hg command, but there isn&#8217;t a way, that I can see, to get something similar to <a href="http://www.kernel.org/pub/software/scm/git/docs/git-merge-base.html">git-merge-base</a>.  You would probably have to hack through and extract out some of the internals of Hg.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nullstyle.com/2007/06/22/create-custom-commands-in-git/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
