<?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>Mark McLoughlin &#187; git</title>
	<atom:link href="http://blogs.gnome.org/markmc/category/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/markmc</link>
	<description>Just another GNOME Blogs weblog</description>
	<lastBuildDate>Thu, 20 Oct 2011 06:03:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Git Workflow</title>
		<link>http://blogs.gnome.org/markmc/2008/05/07/git-workflow/</link>
		<comments>http://blogs.gnome.org/markmc/2008/05/07/git-workflow/#comments</comments>
		<pubDate>Wed, 07 May 2008 07:55:02 +0000</pubDate>
		<dc:creator>markmc</dc:creator>
				<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/markmc/2008/05/07/git-workflow/</guid>
		<description><![CDATA[Havoc&#8217;s recent post on git was interesting because it shows how frustrating git can be if you try and treat it as &#8220;just another CVS&#8221;. From that perspective, git just seems like it&#8217;s just some bizarre way for kernel hackers to torture those who just want to get work done. I turned that corner with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://log.ometer.com/2008-04.html#29">Havoc&#8217;s recent post on git</a> was interesting because it shows how frustrating git can be if you try and treat it as &#8220;just another CVS&#8221;. From that perspective, git just seems like it&#8217;s just some bizarre way for kernel hackers to torture those who <em>just want to get work done</em>.</p>
<p>I turned that corner with git when I learned about &#8220;git-rebase -i&#8221; and came to the startling realisation that <em>git&#8217;s history is editable</em>. Basically, this allows you to change your workflow such that you can hack away at will, commit often and then rewrite the history of your hacking session so that you have a coherent set of patches/commits at the end of it with a useful changelog.</p>
<p>e.g. you can go from:</p>
<blockquote>
<pre>A1---B1---A2---A3---C1---B2---C2---C3</pre>
</blockquote>
<p>to:</p>
<blockquote>
<pre>A1---A2---A3---B1---B2---C1---C2---C3</pre>
</blockquote>
<p>or even:</p>
<blockquote>
<pre>A'---B'---C'</pre>
</blockquote>
<p>Using git rebasing, I found that I could use a similar workflow to using <a href="http://savannah.nongnu.org/projects/quilt">quilt</a> with CVS, or mercurial with its <a href="http://www.selenic.com/mercurial/wiki/index.cgi/MqExtension">patch queue (mq) extension</a>. The revision history becomes less about tracking the progress of your work, and more a maleable mechanism for preparing patches before submitting upstream.</p>
<p><a href="http://www.redhatmagazine.com">Red Hat Magazine</a> has a <a href="http://www.redhatmagazine.com/2008/05/02/shipping-quality-code-with-git/">nice article</a> explaining all this, and I even picked up some new tricks to try out:</p>
<ul>
<li><tt>git-merge --squash</tt> : merge a branch/tag into the current branch, but squash all the commits together as an uncommitted change to the working tree. When you go to commit the result, the changelog of all the merged commits is available in the commit message editor so you can munge them together into a useful changelog.</li>
<li><tt>git-cherry-pick --no-commit</tt> : apply the changes from a given commit to your working tree, but do not commit it. Could be used to achieve something similar to a squashed merge, but where you selectively merge only some of the commits.</li>
<li><tt>git-add --patch/--interactive</tt> : add some changes from the working tree to the index, but e.g. selectively add only some of the patch hunks from a given file. Allows you to make a bunch of changes to a file, but commit the changes as individual commits.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/markmc/2008/05/07/git-workflow/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blogs.gnome.org/markmc/category/git/feed/ ) in 1.17210 seconds, on Feb 10th, 2012 at 9:43 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 10th, 2012 at 10:43 pm UTC -->
