<?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>某人的栖息地 &#187; git</title>
	<atom:link href="http://www.ooso.net/tag/git/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ooso.net</link>
	<description>Linux + Apache + Mysql + Php + Flash</description>
	<lastBuildDate>Thu, 19 Jan 2012 01:21:44 +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 flow使用经验小记</title>
		<link>http://www.ooso.net/archives/588</link>
		<comments>http://www.ooso.net/archives/588#comments</comments>
		<pubDate>Thu, 23 Jun 2011 02:25:43 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git-flow]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=588</guid>
		<description><![CDATA[我在半年前开始在公司内推广使用git flow，控制版本发布流程，到目前为止效果令人满意。
但是实际使用过程中有一些小小的意外流程，完全照搬git flow的模型不太容易处理好。好在git本身就很灵活，碰到问题基本上都有办法绕过去。下面是我总结的一些特例情况下的处理办法。

测试/共享单独一个feature

				<span class="readmore"><a href="http://www.ooso.net/archives/588" title="git flow使用经验小记">阅读全文（838字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>我在半年前开始在公司内推广使用<a href="http://nvie.com/posts/a-successful-git-branching-model/">git flow</a>，控制版本发布流程，到目前为止效果令人满意。</p>
<p>但是实际使用过程中有一些小小的意外流程，完全照搬git flow的模型不太容易处理好。好在git本身就很灵活，碰到问题基本上都有办法绕过去。下面是我总结的一些特例情况下的处理办法。</p>
<p><img src="http://www.ooso.net/wp-content/uploads/2011/06/gitflow.png" alt="git-flow" /></p>
<h2>测试/共享单独一个feature</h2>
<p>有时候我们需要将一个feature独立测试，或者share给多人一块开发，那么可以将这个feature推到远程git库上，这可以利用git flow的publish功能搞定:</p>
<pre><code>git flow feature publish my_cool_feature</code></pre>
<p>这会将 feature/my_cool_feature 分支push到远程git库，多人开发或者单独测试毫无压力。</p>
<h2>feature在development分支测试完成，准备release的时候有另外一个未经测试的feature合并进来</h2>
<p>已经完成测试的development被未经测试的提交污染了，这时候可以先本地回滚development分支，然后再进行git flow的release流程，例如:</p>
<pre><code>git checkout development
git reset --hard 5cbadfe885d1eb514b3f07b3f269ca1a7f261e21   #假设测试通过的git rev是这个
git flow release start v1.0.1
git flow release finish v1.0.1</code></pre>
<h2>development上有个feature需要测试比较长时间，影响了一些耗时较短的feature发布 </h2>
<p>development分支上有个feature测试时间比较长一直释放不了，怎么办？—— 果断采用hotfix功能</p>
<pre><code>git br -m feature/another_cool_feature hotfix/another_cool_feature</code></pre>
<p>把耗时短的feature直接转换为hotfix，然后采用git flow的hotfix流程可以直接合并到master分支发布。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/588/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用git部署php站点</title>
		<link>http://www.ooso.net/archives/596</link>
		<comments>http://www.ooso.net/archives/596#comments</comments>
		<pubDate>Tue, 29 Mar 2011 03:26:42 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=596</guid>
		<description><![CDATA[在小站点上，直接用git来部署php代码相当方便，你的远程站点以及本地版本库都有一个版本控制，追踪问题或者回滚是很轻松的事情。下面介绍用git部署时的设置步骤
在远程服务器的设置
假定你需要部署的代码在/var/www/yoursite
cd /var/www/yoursite

				<span class="readmore"><a href="http://www.ooso.net/archives/596" title="用git部署php站点">阅读全文（488字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在小站点上，直接用git来部署php代码相当方便，你的远程站点以及本地版本库都有一个版本控制，追踪问题或者回滚是很轻松的事情。下面介绍用git部署时的设置步骤</p>
<h2>在远程服务器的设置</h2>
<p>假定你需要部署的代码在/var/www/yoursite</p>
<pre><code>cd /var/www/yoursite
git init .
git config receive.denyCurrentBranch ignore
git config --bool receive.denyNonFastForwards false
cd .git/hooks
wget http://utsl.gen.nz/git/post-update
chmod +x post-update</code></pre>
<h2>在本地git库中新增配置</h2>
<pre><code>[remote "prod"]
        url = your-ssh-username@your-host:/var/www/yoursite/</code></pre>
<p>这样就算设置完成了。</p>
<p>如果你想把本地的代码推送到远程服务器，下面简单的步骤就可以做到</p>
<pre><code>git pull
git push prod</code></pre>
<h2>注意事项</h2>
<p>如果远程服务器上git的配置目录.git暴露在外部可访问的位置，请在web服务器上设置这个目录不可见。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/596/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>git svn实战</title>
		<link>http://www.ooso.net/archives/576</link>
		<comments>http://www.ooso.net/archives/576#comments</comments>
		<pubDate>Mon, 17 Jan 2011 07:26:36 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[code-prettify]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git-svn]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=576</guid>
		<description><![CDATA[我之前写了几个wordpress插件，比如inline-javascript, code-prettify。这些插件都托管在wordpress.org提供的svn服务器上，但是我实在太喜欢在git下活动了，因此动了点心思，想把插件代码传到github上，开发完之后利用git-svn传到wordpress的svn服务上。
照着这个思路，捋起袖子就开干了。
用git-svn抓取插件代码
wordpress的插件svn库大且缓慢，如果直接用git-svn去clone代码，一定会慢死，所以我按照以前的笔记，用git从大型svn快速clone代码。

				<span class="readmore"><a href="http://www.ooso.net/archives/576" title="git svn实战">阅读全文（950字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>我之前写了几个wordpress插件，比如<a href="http://www.ooso.net/inline-js">inline-javascript</a>, <a href="http://www.ooso.net/code-prettify">code-prettify</a>。这些插件都托管在wordpress.org提供的svn服务器上，但是我实在太喜欢在git下活动了，因此动了点心思，想把插件代码传到github上，开发完之后利用<a href="/tag/git-svn">git-svn</a>传到wordpress的svn服务上。</p>
<p>照着这个思路，捋起袖子就开干了。</p>
<h2>用git-svn抓取插件代码</h2>
<p>wordpress的插件svn库大且缓慢，如果直接用git-svn去clone代码，一定会慢死，所以我按照以前的笔记，<a href="http://www.ooso.net/archives/523">用git从大型svn快速clone代码</a>。</p>
<p>以code-prettify插件为例，首先需要读取这个插件创建时的版本号</p>
<pre>
<code>svn log http://svn.wp-plugins.org/code-prettify|tail -4|head -1</code>
</pre>
<p>得到了如下信息，获得一个版本号 318479</p>
<pre><code>r318479 | plugin-master | 2010-12-03 20:12:29 +0800 (五, 03 12 2010) | 1 line</code></pre>
<p>开始clone代码</p>
<pre><code>git svn clone -s --prefix=svn/ -r318479:HEAD http://svn.wp-plugins.org/code-prettify</code></pre>
<h2>设置git仓库</h2>
<p>首先把代码传了一份到github: <a href="https://github.com/volca/code-prettify">https://github.com/volca/code-prettify</a></p>
<p>然后操作本地git仓库</p>
<pre>
<code>git branch -m svn
git remote add origin git@github.com:volca/code-prettify.git
git checkout master</code>
</pre>
<p>本地svn分支对应svn的远程仓库，本地master分支对应github的远程仓库</p>
<h2>Happy time</h2>
<p>现在可以按照平常的习惯在git下更改代码，然后用git push到github上。</p>
<p>如果需要更新代码到svn上，按这个流程操作就可以了：</p>
<pre>
<code>git checkout svn
git merge master
git svn dcommit</code>
</pre>
<p>如果需要发布wordpress插件的新版本，这个在svn里就是一个打tag的过程，用git-svn操作非常简单，下面的例子表示发布code-prettify插件的0.3版本：</p>
<pre>
<code>git svn tag 0.3
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/576/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>试着开源LiteCloud项目</title>
		<link>http://www.ooso.net/archives/554</link>
		<comments>http://www.ooso.net/archives/554#comments</comments>
		<pubDate>Mon, 15 Mar 2010 15:47:32 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[litecloud]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[tokyocabinet]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=554</guid>
		<description><![CDATA[所谓LiteCloud，无非就是前些天提到的LightCloud的php版本实现。这个和原来的python版本有一些区别，会造成不兼容，如下：


把Consistent Hashing算法换成了ketama，在pecl的memcached扩展里有简单方法可以实现，效率比单纯的php好很多，能快个10倍吧。没有重复造轮子，因此我很是得意。

				<span class="readmore"><a href="http://www.ooso.net/archives/554" title="试着开源LiteCloud项目">阅读全文（1844字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>所谓LiteCloud，无非就是<a href="http://www.ooso.net/archives/549">前些天提到的LightCloud</a>的php版本实现。这个和原来的python版本有一些区别，会造成不兼容，如下：</p>
<ul>
<ol>
<li>把Consistent Hashing算法换成了ketama，在pecl的memcached扩展里有简单方法可以实现，效率比单纯的php好很多，能快个10倍吧。没有重复造轮子，因此我很是得意。</li>
<li>静态方法调用时，不再支持原来的system参数，原版是用这个来支持多个LiteCloud集群。</li>
<li>第一个版本，利用memcached扩展来读取tokyo tyrant，所以目前仅支持简单的操作比如get, set, delete, increment。其实再努力一下，也可以支持更多的功能，比如redis。</li>
<li>去掉了原版的local_cache功能，我觉得这个功能完全可以放在外面，更灵活。</li>
</ol>
</ul>
<h2>项目主页</h2>
<p>目前托管在github上 —— <a href="http://github.com/volca/litecloud">LiteCloud</a> ，使用<a href="/tag/git">git</a>以及github的时间不太长，但是很喜欢，欢迎fork。</p>
<h2>使用示例</h2>
<p>用静态方法调用:</p>
<pre><code>require 'LiteCloud.php';

$config = array(
    'lookup1_A' =&gt; '127.0.0.1:41201',
    'lookup1_B' =&gt; '127.0.0.1:51201',

    'storage1_A' =&gt; '127.0.0.1:44201',
    'storage1_B' =&gt; '127.0.0.1:54201',
);

list($lookupNodes, $storageNodes) = LiteCloud::generateNodes($config);
LiteCloud::init($lookupNodes, $storageNodes);

LiteCloud::set('hello', 'world');
print LiteCloud::get("hello"); # =&gt; world
LiteCloud::delete("hello");

print LiteCloud::get("hello"); # =&gt; nil</code></pre>
<p>或者采用实例化的方式调用，这种方式能够支持多个LightCloud集群</p>
<pre><code>require 'LiteCloud.php';

$config = array(
    'lookup1_A' =&gt; '127.0.0.1:41201',
    'lookup1_B' =&gt; '127.0.0.1:51201',

    'storage1_A' =&gt; '127.0.0.1:44201',
    'storage1_B' =&gt; '127.0.0.1:54201',
);

$cloud = new LiteCloud($config);

$cloud-&gt;set('hello', 'world');
print $cloud-&gt;get("hello"); # =&gt; world
$cloud-&gt;delete("hello");

print $cloud-&gt;get("hello"); # =&gt; nil</code></pre>
<p>看上去和python版本差不多，对吧？</p>
<h2>性能测试</h2>
<p>这个部分是个重点，之前找到的lightcloud的php版本，性能比原版要慢一个数量级，我可不想在这个地方丢了份。</p>
<p>暂时做了个最简单的性能测试，测试脚本在test目录下。测试条件如下:</p>
<ul>
<ol>
<li>底层采用tokyo tyrant作为存储。</li>
<li>单个进程重复操作一万次，比如写一万次hello => world，这个测试条件和python版本完全一致</li>
<li>关闭了local_cache</li>
</ol>
</ul>
<h3>python版本的测试结果</h3>
<pre><code>Finished "Tyrant set" 10000 times in 2.50 sec [4002.0 operations pr.sec]
Finished "Tyrant get" 10000 times in 1.04 sec [9583.7 operations pr.sec]
Finished "Tyrant delete" 10000 times in 7.39 sec [1352.4 operations pr.sec]</code></pre>
<h3>LiteCloud的测试结果</h3>
<pre><code>Using 1.8229308128357 time to set 10000 values. QPS:5485.67
Using 0.71097207069397 time to get 10000 values. QPS:14065.25
Using 2.1550960540771 time to delete 10000 values. QPS:4640.16</code></pre>
<p>看上去还比较乐观，尤其是delete的性能翻了好几番，几乎要怀疑我在代码实现部分出了差错，在其它方面的表现也是全面超出，因为python版在hash_ring的实现上拖了后腿。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/554/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>git的代码review工具</title>
		<link>http://www.ooso.net/archives/539</link>
		<comments>http://www.ooso.net/archives/539#comments</comments>
		<pubDate>Thu, 11 Feb 2010 15:34:19 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=539</guid>
		<description><![CDATA[facebook在GitHub上托管了大量的开源项目，足足有26个。其中hiphop-php以及xhp在这阵子炒的比较热，的确是让人印象深刻的东西。顺手把别的项目翻出来看，也有很实用的工具，比如git-review。
git-review为git新增了一个很方便的代码review途径，利用这个命令，可以调用别的工具比如vimdiff来review代码的改动。下面简单记录一下使用的过程：
下载并安装
首先确认已经装好了git，剩下的事情比较简单。

				<span class="readmore"><a href="http://www.ooso.net/archives/539" title="git的代码review工具">阅读全文（711字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/facebook">facebook在GitHub上</a>托管了大量的开源项目，足足有26个。其中hiphop-php以及xhp在这阵子炒的比较热，的确是让人印象深刻的东西。顺手把别的项目翻出来看，也有很实用的工具，比如<a href="http://github.com/facebook/git-review">git-review</a>。</p>
<p>git-review为git新增了一个很方便的代码review途径，利用这个命令，可以调用别的工具比如vimdiff来review代码的改动。下面简单记录一下使用的过程：</p>
<h2>下载并安装</h2>
<p>首先确认已经装好了<a href="/?tag=git">git</a>，剩下的事情比较简单。</p>
<pre><code>git clone git://github.com/facebook/git-review.git
cd git-review
python setup.py install</code></pre>
<p>这几步为git新增了一个review命令。</p>
<h2>git-review的使用</h2>
<h3>查看指定版本的改动</h3>
<pre><code>git review 58e2fb834793f5c6c1fdd900a1c0224a44735962</code></pre>
<p>出现提示</p>
<blockquote><p>
Now processing modified file foo.php<br />
foo.php [diff]&gt;
</p></blockquote>
<p>由于我配置了diff工具为vimdiff，所以接下来就可以用vimdiff查看foo.php在58e2fb834793f5c6c1fdd900a1c0224a44735962这个版本与最新版本之间有什么不同。</p>
<h3>查看两个版本之间的改动</h3>
<pre><code>git review 5b744bdc5f5bcbcfd6bb65f815aebe6bdce8c427 58e2fb834793f5c6c1fdd900a1c0224a44735962</code></pre>
<p>在review每个代码之前，都可以使用help查看git review命令的帮助，如果放弃review，那么直接敲退出就可以了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/539/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用git从svn里clone最后几个版本</title>
		<link>http://www.ooso.net/archives/523</link>
		<comments>http://www.ooso.net/archives/523#comments</comments>
		<pubDate>Sun, 13 Dec 2009 02:44:03 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git-svn]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=523</guid>
		<description><![CDATA[一般情况下git svn clone这个操作会从第一个版本开始同步，如果版本号已经到了好几万（或更高？），这个操作会相当的费时。
当时还想着能不能hack一下git-svn脚本，其实后来看看文档，clone操作可以使用参数-r$REVNUMBER:HEAD检出指定版本后的代码，因此，更好的步骤应该是这样：



				<span class="readmore"><a href="http://www.ooso.net/archives/523" title="用git从svn里clone最后几个版本">阅读全文（302字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>一般情况下<a href="http://www.ooso.net/archives/520#comment-29022">git svn clone这个操作</a>会从第一个版本开始同步，如果版本号已经到了好几万（或更高？），这个操作会相当的费时。</p>
<p>当时还想着能不能hack一下git-svn脚本，其实后来看看文档，clone操作可以使用参数-r$REVNUMBER:HEAD检出指定版本后的代码，因此，更好的步骤应该是这样：</p>
<ol>
<ul>
<li>svn info http://your-svn, 并记录最后的版本号，假设是260</li>
<li>假设要检出最后10个版本，做个简单的减法： 260 &#8211; 10 = 250</li>
<li>开始clone操作了
<pre><code>git svn clone -r250:HEAD --prefix=svn/ http://your-svn</code></pre>
</li>
</ul>
</ol>
<p>按这个办法，clone的时间的确是减少了许多。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/523/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Git-svn on cygwin</title>
		<link>http://www.ooso.net/archives/520</link>
		<comments>http://www.ooso.net/archives/520#comments</comments>
		<pubDate>Thu, 09 Apr 2009 22:55:21 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git-svn]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=520</guid>
		<description><![CDATA[开始试用最近比较红的git，我看中的是它的本地版本库功能，即便网络比较烂的时候，也可以在本地提交，等到了合适的时候一并传上去。由于以前的代码版本控制使用的是svn，所以我用git-svn过渡一下。
目前在windows下，最好的git客户端恐怕就是装一个cygwin。鼓捣了一个时辰，整理好一些可用的配置文件，陈列一下以备下次使用：
~/.bash_profile
偶尔还会使用svn验证一下check in的情况，刚转过来不放心啊，下面的配置是为了防止svn命令行乱码。命令行git-svn在/usr/sbin/git-core/路径下，是一个perl脚本，为了方便，我把这个路径加入了PATH环境变量。

				<span class="readmore"><a href="http://www.ooso.net/archives/520" title="Git-svn on cygwin">阅读全文（828字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>开始试用最近比较红的<a href="/?tag=git">git</a>，我看中的是它的本地版本库功能，即便网络比较烂的时候，也可以在本地提交，等到了合适的时候一并传上去。由于以前的代码版本控制使用的是svn，所以我用git-svn过渡一下。</p>
<p>目前在windows下，最好的git客户端恐怕就是装一个cygwin。鼓捣了一个时辰，整理好一些可用的配置文件，陈列一下以备下次使用：</p>
<h2>~/.bash_profile</h2>
<p>偶尔还会使用svn验证一下check in的情况，刚转过来不放心啊，下面的配置是为了防止svn命令行乱码。命令行git-svn在/usr/sbin/git-core/路径下，是一个perl脚本，为了方便，我把这个路径加入了PATH环境变量。</p>
<pre><code>export PATH=$PATH:/usr/sbin/git-core/
export SVN_EDITOR=vim
export LC_ALL=en_US.UTF-16
export LC_CTYPE=en_US.UTF-16
export LANG=en_US.UTF-16
export XMODIFIERS=@im=Chinput3
stty cs8 -istrip
stty pass8
export LESSCHARSET=latin1</code></pre>
<h2>~/.inputrc</h2>
<p>去掉注释即可</p>
<pre><code>set meta-flag on
set convert-meta off
set input-meta on
set output-meta on</code></pre>
<h2>~/.gitconfig</h2>
<pre><code>[user]
name = muhaha
email = aa@bb.cc

[color]
diff = auto
status = auto
branch = auto

[alias]
st = status
rb = svn rebase
ci = commit -a
co = checkout</code></pre>
<h2>常用操作</h2>
<table border="1">
<tr>
<td>clone一个svn</td>
<td>git svn clone -s svn://xxx.xxx.com</td>
</tr>
<tr>
<td>类svn up操作？</td>
<td>git svn rebase</td>
</tr>
<tr>
<td>添加文件</td>
<td>git add xfile</td>
</tr>
<tr>
<td>check in</td>
<td>git ci</td>
</tr>
<tr>
<td>往svn库提交</td>
<td>git svn dcommit</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/520/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

