<?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>Kanru&#039;s 探險日誌 &#187; prompt</title>
	<atom:link href="http://blog.kanru.info/archives/tag/prompt/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.kanru.info</link>
	<description>當發現美好的事物時，所要做的第一件事，就是把它分享給所有人</description>
	<lastBuildDate>Sun, 23 May 2010 09:51:05 +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>Git branch in bash prompt</title>
		<link>http://blog.kanru.info/archives/550</link>
		<comments>http://blog.kanru.info/archives/550#comments</comments>
		<pubDate>Sat, 13 Dec 2008 12:47:54 +0000</pubDate>
		<dc:creator>kanru</dc:creator>
				<category><![CDATA[小工具]]></category>
		<category><![CDATA[爬網探險]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.kanru.info/?p=550</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.kanru.info/archives/343">之前</a>提過 zsh 有支援在 prompt 上顯示多種 VCS 資訊的功能，不知道 bash 上是否有人寫好同樣支援這麼多種 VCS 的 library，不過目前 git 附帶的 bash completion script 中有提供自訂 PS1 的函式。</p>

<p>只要呼叫 <code>__git_ps1</code> 即可得到目前的 git branch 的格式化輸出，可以自訂 prompt 如下</p>

<p><pre lang="plain">
GITPS1='$(__git_ps1 ":%s ")'
export PS1="\w ${GITPS1}&#92;$ "
</pre></p>

<p>就會顯示如</p>

<p><pre lang="plain">
/usr/src/awesome :next $
</pre></p>

<p>這樣的 prompt</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kanru.info/archives/550/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
