<?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>Nicolas Kuttler &#187; git</title>
	<atom:link href="http://www.nkuttler.de/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nkuttler.de</link>
	<description>WordPress Services, IT Services</description>
	<lastBuildDate>Wed, 28 Jul 2010 23:49:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using git for WordPress development</title>
		<link>http://www.nkuttler.de/2009/11/07/using-git-for-wordpress-development/</link>
		<comments>http://www.nkuttler.de/2009/11/07/using-git-for-wordpress-development/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 14:34:55 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de/?p=1274</guid>
		<description><![CDATA[git is a powerful revision control system. It is a distributed system. This means that you can commit, create branches or tags on your local hard drive without any network connection. Read more about git on the project&#8217;s website, there&#8217;s also great documentation there. If you write WordPress plugins and want them to be published [...]]]></description>
			<content:encoded><![CDATA[<p><tt>git</tt> is a powerful revision control system. It is a <strong>distributed</strong> system. This means that you can commit, create branches or tags on your local hard drive without any network connection. Read more about git on the project&#8217;s <a href="http://git-scm.com/">website</a>, there&#8217;s also great documentation there.<span id="more-1274"></span></p>
<p>If you write WordPress plugins and want them to be published on the <a href="http://wordpress.org/extend/plugins/">WordPress plugins page</a> you have to use <tt>svn</tt> which can be painful once you&#8217;re used to <tt>git</tt>.</p>
<p>Fortunately, <tt>git</tt> can interact with <tt>svn</tt> via <tt>git-svn</tt>. Here&#8217;s a list of the commands you will need to use.</p>

<div class="wp_syntax"><div class="code"><pre class="git" style="font-family:monospace;">git svn init -s http://svn.wp-plugins.org/your_plugin</pre></div></div>

<p><strong>Update</strong>:<br />
The <code>git svn init + git svn fetch</code> takes forever on the WordPress repository. Instead, use <code>svn log http://svn.wp-plugins.org/your_plugin</code> to get the correct revision number and <code>git svn clone http://svn.wp-plugins.org/your_plugin -rYOURREVISION</code>.</p>
<p>This will initialize a local <tt>git</tt> repository. Inside the repository, use</p>

<div class="wp_syntax"><div class="code"><pre class="git" style="font-family:monospace;">git svn fetch
git gc
git branch -a</pre></div></div>

<p>The first command will take a few minutes and fetch all tags, branches etc. from the <tt>svn</tt> repository. The second command cleans up your git repository. This will significantly reduce it&#8217;s size. The last command will list all branches, local and remote. To track the remote trunk in a local branch use</p>

<div class="wp_syntax"><div class="code"><pre class="git" style="font-family:monospace;">git checkout -b svn-trunk trunk</pre></div></div>

<p><tt>svn-trunk</tt> is just the name the local branch gets in this example, you can use anything you like.</p>
<p>A normal workflow usually looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git checkout <span style="color: #660033;">-b</span> newbranch <span style="color: #666666; font-style: italic;"># create a local branch that you edit</span>
... edit ...
git commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Added awesome new feature&quot;</span> <span style="color: #660033;">-a</span>
git checkout svn-trunk
git merge newbranch
git <span style="color: #c20cb9; font-weight: bold;">svn</span> dcommit</pre></div></div>

<p>These commands create a local branch where you can try new things. Commit the changes to your local branch. Then check out the local svn-trunk branch that tracks the remote WordPress repository, merge the changes from newbranch. Then rebase the svn branch to the subversion trunk. The last command will update the remote <tt>svn</tt> trunk, assuming you really named your local trunk branch <tt>svn-trunk</tt>. As we&#8217;re talking about WordPress plugins you&#8217;ll want to tag your commit so that older versions of your plugin can still be downloaded.</p>

<div class="wp_syntax"><div class="code"><pre class="git" style="font-family:monospace;">git svn tag version</pre></div></div>

<p>This will create the tag in the remote <tt>svn</tt> repository. It looks like this is only possible since <tt>git</tt> 1.6.1. For Debian Lenny systems you&#8217;ll need <tt>git</tt> from <a href="http://backports.org/">backports.org</a> for this to work.</p>
<p>This should get you started with <tt>git</tt> and WordPress plugin development. Please do read the <tt>git</tt> documentation for more details, as <tt>git-svn</tt> has some limitations: Only use the described workflow if you&#8217;re the only commiter and work with one git repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2009/11/07/using-git-for-wordpress-development/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Git clone, ssh: Could not resolve hostname</title>
		<link>http://www.nkuttler.de/2009/04/06/git-clone-ssh-could-not-resolve-hostname/</link>
		<comments>http://www.nkuttler.de/2009/04/06/git-clone-ssh-could-not-resolve-hostname/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 15:06:58 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=764</guid>
		<description><![CDATA[Now this was annoying. I tried a git clone ssh://user@my.host:/path/to/repository and it failed with Initialized empty Git repository in /current/path/repository/.git/ ssh: Could not resolve hostname my.host:: Name or service not known fatal: The remote end hung up unexpectedly The solution was rather easy, see man 1 git-clone. A valid git URL looks like this: ssh://[user@]host.xz/path/to/repo.git/ [...]]]></description>
			<content:encoded><![CDATA[<p>Now this was annoying. I tried a <tt>git clone ssh://user@my.host:/path/to/repository</tt> and it failed with</p>
<pre>
Initialized empty Git repository in /current/path/repository/.git/
ssh: Could not resolve hostname my.host:: Name or service not known
fatal: The remote end hung up unexpectedly
</pre>
<p><span id="more-764"></span><br />
The solution was rather easy, see <tt>man 1 git-clone</tt>. A valid git URL looks like this:</p>
<pre>
ssh://[user@]host.xz/path/to/repo.git/
</pre>
<p>Don&#8217;t try to use paths as ports. <tt>git</tt> isn&#8217;t <tt>scp</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2009/04/06/git-clone-ssh-could-not-resolve-hostname/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
