<?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>Kerry Buckley &#187; git</title>
	<atom:link href="http://www.kerrybuckley.org/category/software/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kerrybuckley.org</link>
	<description>What's the simplest thing that could possibly go wrong?</description>
	<lastBuildDate>Wed, 30 Nov 2011 11:26:56 +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>Build and push to upstream git repository in the background</title>
		<link>http://www.kerrybuckley.org/2010/12/20/build-and-push-to-upstream-git-repository-in-the-background/</link>
		<comments>http://www.kerrybuckley.org/2010/12/20/build-and-push-to-upstream-git-repository-in-the-background/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 17:14:00 +0000</pubDate>
		<dc:creator>Kerry</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.kerrybuckley.org/?p=408</guid>
		<description><![CDATA[[Updated 11 Feb 2011 &#8211; I'm not sure the original version actually worked properly.] Quite often I'll make small changes to a project's code which I'm 99% sure won't break the build. Of course thanks to Murphy's Law that probability falls to about 10% if I decide to risk it push the changes upstream without [...]]]></description>
			<content:encoded><![CDATA[<p>[Updated 11 Feb 2011 &ndash; I'm not sure the original version actually worked properly.]</p>
<p>Quite often I'll make small changes to a project's code which I'm 99% sure won't break the build. Of course thanks to Murphy's Law that probability falls to about 10% if I decide to risk it push the changes upstream without running the full build locally.</p>
<p>Now even if the build only takes a few minutes to run, that's a few minutes which I can't spend doing anything else with the code, because if I save a file I can't be sure whether the original or changed version will be used in the tests. What I'd like to be able to do is to run the build in the background, with changes automatically pushed upstream if everything's green, or an alert shown if either the build fails or the push is rejected (because someone else has pushed a change while the build was running).</p>
<p>Fortunately with a distributed version control system like git, this is fairly easy.</p>
<p>Firstly, clone the local working repository and set up a remote pointing to  the clone:</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showCodeTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git clone . ../myproject-staging</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git remote add staging ../myproject-staging </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now set up the cloned copy:</p>
<div class="igBar"><span id="lcode-7"><a href="#" onclick="javascript:showCodeTxt('code-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-7">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cd ../myproject-staging</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Allow pushing into the checked-out branch</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git config receive.<span style="">denyCurrentBranch</span> ignore</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Create a remote for the upstream server you want to push to <span style="color:#006600; font-weight:bold;">&#40;</span>change the URI!<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git remote add upstream git@your.<span style="">upstream</span>.<span style="">server</span>/your/repository/path.<span style="">git</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Do anything that needs doing to allow the cloned project to build (if you have a test database, create a separate instance to avoid tests interacting with your main workspace), and verify that the build runs.</p>
<p>Now add the following to <code>.git/hooks/post-receive</code>:</p>
<div class="igBar"><span id="lcode-8"><a href="#" onclick="javascript:showCodeTxt('code-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-8">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cd ..</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">export</span> GIT_DIR=.<span style="">git</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git reset --hard</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">nohup .<span style="">git</span>/hooks/post-reset <span style="color:#800000;color:#800000;">1</span>&gt; build_output <span style="color:#800000;color:#800000;">2</span>&gt;&amp;<span style="color:#800000;color:#800000;">1</span> &amp; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This will reset your checked-out working copy to the pushed master, then run <code>.git/hooks/post-reset</code> in the background. Create that file with the following content:</p>
<div class="igBar"><span id="lcode-9"><a href="#" onclick="javascript:showCodeTxt('code-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-9">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function error <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; growlnotify -s -t `basename $PWD` -m <span style="color:#CC0000;">"$1"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; exit <span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Replace this with your build command</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">bundle install --local &amp;&amp; rake || error <span style="color:#CC0000;">"Rake failed"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git push upstream master || error <span style="color:#CC0000;">"Git push failed"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">growlnotify -s -t `basename $PWD` -m <span style="color:#CC0000;">"Built and pushed successfully"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Make sure both these hooks are executable:</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showCodeTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">chmod u+x .<span style="">git</span>/hooks/post*-receive </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now, back in your normal working repository you should just be able to type <code>git push staging</code> (add <code>--force</code> if you've rebased your normal master and get an error about the push not being a fast-forward), and the project will build in the staging repo. If everything works, it'll push upstream and you'll get a Growl notification (assuming you have <a href="http://growl.info/">Growl</a> and growlnotify, or the equivalents for your OS, installed). If it fails, you'll also get a Growl notification. I've made the alerts sticky, so I don't miss them &ndash; if you don't want that, just remove the <code>-s</code> flag. The build errors will be in the <code>build_output</code> file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerrybuckley.org/2010/12/20/build-and-push-to-upstream-git-repository-in-the-background/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maintaining a Read-Only svn Mirror of a git Repository</title>
		<link>http://www.kerrybuckley.org/2009/10/06/maintaining-a-read-only-svn-mirror-of-a-git-repository/</link>
		<comments>http://www.kerrybuckley.org/2009/10/06/maintaining-a-read-only-svn-mirror-of-a-git-repository/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 10:17:39 +0000</pubDate>
		<dc:creator>Kerry</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.kerrybuckley.org/?p=243</guid>
		<description><![CDATA[Our team been using git at work for the past couple of years, but there's now a corporate push to keep everything in a centrally-managed subversion repository. We lost the battle to get corporate approval for git (apparently we're happy to employ people to write our code that we wouldn't trust to be able to [...]]]></description>
			<content:encoded><![CDATA[<p>Our team been using <a href="http://git.or.cz/">git</a> at work for the past couple of years, but there's now a corporate push to keep everything in a centrally-managed subversion repository. We lost the battle to get corporate approval for git (apparently we're happy to employ people to write our code that we wouldn't trust to be able to use a DVCS), but at least we have agreement that we can continue using git as long as we mirror the code into subversion.</p>
<p>This isn't entirely trivial to do using git-svn (which is really intended for use with subversion acting as the master), but I found a few sets of instructions on the web. The simplest one was this <a href="http://blog.nanorails.com/articles/2008/1/31/git-to-svn-read-only">Nano Rails blog post</a>, which is what the steps below are based on.</p>
<p>The end result should be a subversion <em>trunk</em> which is a mirror of the git repository's <em>master</em> branch. This is only intended to be a one-way mirror &ndash; I wouldn't recommend also trying to commit into subversion and merge those commits back upstream into git.</p>
<p>You need to have git-svn installed (this comes with the default installation, or you can use the <code>+svn</code> option when installing via MacPorts).</p>
<h4>Create subversion repository</h4>
<p>Create the subversion repository in the usual way, using <code>svnadmin</code>.</p>
<p>Once you've got an empty repository to point to (we'll imagine it's at <code>http://svn.example.com/foo</code>), you also need to commit an initial version (I also created a <code>trunk</code> directory in this step, in case we later decide to mirror branches too):</p>
<pre>
svn co http://svn.example.com/foo
cd myproj
svn mkdir trunk
svn commit -m'Created trunk directory'
</pre>
<p>Once this is done, you can throw away the directory you checked out of subversion.</p>
<h4>Set up the subversion remote</h4>
<p>This step, and subsequent ones, need to be performed on whichever git repository you want to mirror from.</p>
<p>In our case, we have a central repository running on a local installation of <a href="http://gitorious.org/">Gitorious</a>. This is a bare repository, which makes things a little tricker, as git-svn requires a working copy. To get round this, we create a clone, which we'll use as an intermediate step in the mirroring process. If you're not mirroring a bare repository, you can omit this step.</p>
<p>The repositories we want to mirror are in <code>~git/repositories</code>, and we've created a directory <code>~git/repositories/svn-mirror </code>where we'll put the clones. For this example, we'll use a repository called <code>foo/mainline.git</code>.</p>
<p>Create the clone:</p>
<pre>
git clone ~git/repositories/foo/mainline.git ~git/repositories/svn-mirror/foo
cd ~git/repositories/svn-mirror/foo
</pre>
<p>Now add the following to <code>.git/config</code> (with the correct svn URI, of course):</p>
<pre>
[svn-remote "svn"]
	url = http://svn.example.com/foo/trunk
	fetch = :refs/remotes/git-svn
</pre>
<p>Now do an initial fetch of the empty subversion remote, and check it out as a new git branch (called <em>svn</em>):</p>
<pre>
git svn fetch svn
git checkout -b svn git-svn
</pre>
<p>You can now merge in all your commits from master, and push them to subversion. You'll probably want to go and make a coffee or something while the <em>dcommit</em> runs &ndash; if you haven't used subversion for a while you've probably forgotten just how much slower it is than git.</p>
<pre>
git merge master
git svn dcommit
</pre>
<p>To allow pushing to svn from master, rebase master to the svn branch (which can then be deleted):</p>
<pre>
git checkout master
git rebase svn
git branch -d svn
</pre>
<p>At this point you should be able to manually update subversion at any time by running <code>git svn dcommit</code> from the master branch.</p>
<h4>Automating subversion updates</h4>
<p>In theory it should be possible to set up post-receive hooks to push from the gitorious repository to the clone and from there to subversion, but I decided to separate the two by just periodically polling for changes, as we don't really care about subversion being right up-to-the-minute. To poll hourly, add something like this to the git user's crontab:</p>
<pre>
0 * * * * (cd /usr/local/git/repositories/svn-mirror/foo;/usr/local/bin/git pull origin master;/usr/local/bin/git svn dcommit) >>/usr/local/git/gitorious/log/svn-mirror.log 2>&#038;1
</pre>
<p>Technorati Tags: <a href="http://technorati.com/tag/svn" rel="tag">svn</a>, <a href="http://technorati.com/tag/subversion" rel="tag"> subversion</a>, <a href="http://technorati.com/tag/git" rel="tag"> git</a>, <a href="http://technorati.com/tag/mirror" rel="tag"> mirror</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerrybuckley.org/2009/10/06/maintaining-a-read-only-svn-mirror-of-a-git-repository/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Avoiding Merge Commits in Git</title>
		<link>http://www.kerrybuckley.org/2008/06/18/avoiding-merge-commits-in-git/</link>
		<comments>http://www.kerrybuckley.org/2008/06/18/avoiding-merge-commits-in-git/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 18:23:04 +0000</pubDate>
		<dc:creator>Kerry</dc:creator>
				<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.kerrybuckley.org/2008/06/18/avoiding-merge-commits-in-git/</guid>
		<description><![CDATA[[Update, 18/8/2008] If you've shared the branch with anyone else, or are pushing it to a clone of the repository, do not rebase, but use merge instead. From the man page: When you rebase a branch, you are changing its history in a way that will cause problems for anyone who already has a copy [...]]]></description>
			<content:encoded><![CDATA[<p>[<strong>Update, 18/8/2008] </strong> If you've shared the branch with anyone else, or are pushing it to a clone of the repository, <em>do not</em> rebase, but use merge instead. From the man page:</p>
<blockquote><p>
When you rebase a branch, you are changing its history in a way that will cause problems for anyone who already has a copy of the branch in their repository and tries to pull updates from you. You should understand the implications of using git rebase on a repository that you share.<br />
</blockquote >
<hr />
<p>Do you get annoyed by seeing things like this in your git history?</p>
<pre>commit a0b46a7c57e37f5dc43373ba9167ad2da32c1ec5
Merge: c2d8046... 73e0e15...
Author: Fred Bloggs <fred.bloggs@example.com>
Date:   Tue Jun 17 17:30:49 2008 +0100

    Merge branch 'master' into new_feature

commit c2d8046c038d47940944e5b343d281b1d0c4d2b3
Author: Fred Bloggs <fred.bloggs@example.com>
Date:   Tue Jun 17 17:30:43 2008 +0100

    Added cool new feature</pre>
<p>This happens when you use merge instead of rebase to keep a development branch up-to-date with master. Let's watch what happens in each case.</p>
<h4>The wrong way (merge)</h4>
<p>You're working on a cool new feature in your <em>new_feature</em> branch. You've committed two changes, and in the meantime there have been three other changes on <em>master</em>. Here's the branch visualisation from <code>gitk --all</code>:</p>
<p><img src='/wp-content/uploads/2008/06/picture-1.png' alt='Before merge' /></p>
<p>You use merge to pull in those other three changes to your branch:</p>
<pre>$ git merge master
Merge made by recursive.
 file_1 |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)</pre>
<p>Now what this has actually done is added the changes from <em>master</em> as a new commit in <em>new_feature</em>. You can see this in the history:</p>
<pre>myproj(new_feature) $ git log -1
commit cbc97a909641d3c325c6023a2459e556e62182e6
Merge: 024dc64... 0a71c4c...
Author: Kerry Buckley <kerryjbuckley@gmail.com>
Date:   Wed Jun 18 18:52:48 2008 +0100

    Merge branch 'master' into new_feature
</pre>
<p>And also in the <code>gitk</code> graph:</p>
<p><img src='/wp-content/uploads/2008/06/picture-2.png' alt='After merge to branch' /></p>
<p>Now let's say your new feature is all finished, so you merge it into <em>master</em>:</p>
<pre>myproj(new_feature) $ git checkout master
Switched to branch "master"
myproj(master) $ git merge new_feature
Updating 0a71c4c..cbc97a9
Fast forward
 file_3 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
</pre>
<p>Let's see what that's done to the history:</p>
<pre>myproj(master) $ git log
commit cbc97a909641d3c325c6023a2459e556e62182e6
Merge: 024dc64... 0a71c4c...
Author: Kerry Buckley <kerryjbuckley@gmail.com>
Date:   Wed Jun 18 18:52:48 2008 +0100

    Merge branch 'master' into new_feature

commit 0a71c4c90aee5eeb60d15f199c4f8151756a8ae8
Author: Kerry Buckley <kerryjbuckley@gmail.com>
Date:   Wed Jun 18 18:48:19 2008 +0100

    Third change in master

commit 9970c0b72e7741804fc07bba50450b3d512e5572
Author: Kerry Buckley <kerryjbuckley@gmail.com>
Date:   Wed Jun 18 18:48:10 2008 +0100

    Second change in master

commit c44af4dee449082adf6741540d2f9e70968cf41e
Author: Kerry Buckley <kerryjbuckley@gmail.com>
Date:   Wed Jun 18 18:46:33 2008 +0100

    First change in master

commit 024dc64022932a5a7b56c4fd7c7cf4a59d72e825
Author: Kerry Buckley <kerryjbuckley@gmail.com>
Date:   Wed Jun 18 18:45:15 2008 +0100

    New feature finished

commit eb4f05fb8ef8b93cf639b1e06528ef075f19f323
Author: Kerry Buckley <kerryjbuckley@gmail.com>
Date:   Wed Jun 18 18:45:01 2008 +0100

    New feature partly done

commit b4ffa1d35f808cc38e5f74fb2592224dd6f0e027
Author: Kerry Buckley <kerryjbuckley@gmail.com>
Date:   Wed Jun 18 18:44:02 2008 +0100

    Last commit before creating branch</pre>
<p>Or graphically:</p>
<p><img src='/wp-content/uploads/2008/06/picture-3.png' alt='After merge to master' /></p>
<p>The problem here is that the merge has applied all of the commits which were on <em>new_feature</em> but not on <em>master</em>, <strong>including the merge commit</strong>. That's just ugly.</p>
<h4>The right way (rebase)</h4>
<p>Now, from exactly the same point, we'll use rebase instead:</p>
<pre>myproj(new_feature) $ git rebase master
First, rewinding head to replay your work on top of it...
HEAD is now at a644c41 Third change in master
Applying New feature partly done
Applying New feature finished</pre>
<p>Basically, as it says, this has rewound all your changes since the <em>new_feature</em> branch diverged from <em>master</em>, moved the branch point up to the tip of <em>master</em>, then replayed your changes on top. The effect of this is as if you had created the branch from the current latest <em>master</em>, so no separate merge commit is required. Again, <code>gitk --all</code> can confirm this visually:</p>
<p><img src='http://www.kerrybuckley.org/wp-content/uploads/2008/06/picture-4.png' alt='After rebase' /></p>
<p>Now merge the changes into <em>master</em> exactly as before:</p>
<pre>myproj(new_feature) $ git checkout master
Switched to branch "master"
myproj(master) $ git merge new_feature
Updating a644c41..d7d2233
Fast forward
 file_3 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)</pre>
<p>No merge commit in the history this time, and a nice simple graph:</p>
<p><img src='http://www.kerrybuckley.org/wp-content/uploads/2008/06/picture-5.png' alt='After rebase and merge' /></p>
<p>So there you have it. No excuse for polluting your history with merges any more!</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/git" rel="tag">git</a>, <a href="http://technorati.com/tag/merge" rel="tag"> merge</a>, <a href="http://technorati.com/tag/rebase" rel="tag"> rebase</a>, <a href="http://technorati.com/tag/branch" rel="tag"> branch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerrybuckley.org/2008/06/18/avoiding-merge-commits-in-git/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.395 seconds -->

