<?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>Geoff Evason &#187; terminal</title>
	<atom:link href="http://geoff.evason.name/tag/terminal/feed/" rel="self" type="application/rss+xml" />
	<link>http://geoff.evason.name</link>
	<description></description>
	<lastBuildDate>Wed, 30 Nov 2011 03:41:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>My .bash_profile for git &amp; Rails</title>
		<link>http://geoff.evason.name/2008/08/19/my-bash_profile-for-git-rails/</link>
		<comments>http://geoff.evason.name/2008/08/19/my-bash_profile-for-git-rails/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 20:20:19 +0000</pubDate>
		<dc:creator>Geoff</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[.bash_profile]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://geoff.evason.name/?p=50</guid>
		<description><![CDATA[I&#8217;ve converted all of my projects from svn to git.  If you haven&#8217;t done so already, and can do it, I would recommend not waiting anymore.  It does make things better.  
I used to really like the visual representations available on svn (such as tortoise svn) and rarely used the command line for repository related [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve converted all of my projects from svn to git.  If you haven&#8217;t done so already, and can do it, I would recommend not waiting anymore.  It does make things better.  </p>
<p>I used to really like the visual representations available on svn (such as tortoise svn) and rarely used the command line for repository related things.  The way git works (in particular, not having to have a special &#8217;svn folder within each folder) makes managing files way easier.  The best way to learn is to check out the <a title="git peep code" href="http://peepcode.com/products/git">git peepcode</a>.  I borrowed some of the aliases below from the screencast.</p>
<p>Now that I&#8217;m on the command line more, I&#8217;ve created a .bash_profile to make my life easier.  It is full of nice goodies that I collected.  I figured that I&#8217;d share it with the world in case others find it helpful.  It includes:</p>
<ul>
<li>Updating the OSX Leopard terminal title bar (and potentially the tabs) to include the working directory</li>
<li>Updating the command prompt to include the current directory and the current git branch (if you&#8217;re in a git repo)</li>
<li>Lots of aliases to save myself keystrokes.</li>
</ul>
<pre><code>
# Get the name of the current git branc
function parse_git_branch {
  git branch --no-color 2&gt; /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}

# Update the command prompt to be &lt;user&gt;:&lt;current_directory&gt;(git_branch) &gt;
# Note that the git branch is given a special color
function set_my_prompt {
  PS1="\u:\w\e[1;34m\$(parse_git_branch)\e[m &gt; "
}

# Update the title for the terminal window to be the full working dir
function set_term_title
{
    local title="$1"
    if [[ -z "$title" ]]; then
        title="root"
    fi

    local tmpdir=~/Library/Caches/${FUNCNAME}_temp
    local cmdfile="$tmpdir/$title"

    # Set window title
    #echo -n -e "\e]0;${title}\a"
    echo -n -e "\e]0;${PWD#*/}\a"

   # Set tab title
   # This works by creating a process with the name of the working dir.  
   # So, the tab name doesn't stick if you start running a mongrel server <img src='http://geoff.evason.name/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />
    if [[ -n ${CURRENT_TAB_TITLE_PID:+1} ]]; then
        kill $CURRENT_TAB_TITLE_PID
    fi
    mkdir -p $tmpdir
    ln /bin/sleep "$cmdfile"
    "$cmdfile" 10 &amp;
    CURRENT_TAB_TITLE_PID=$(jobs -x echo %+)
    disown %+
    kill -STOP $CURRENT_TAB_TITLE_PID
    command rm -f "$cmdfile"
}

set_my_prompt
PROMPT_COMMAND='set_term_title "${PWD##*/}"'

# Some aliases I find useful
alias gclb="git checkout -b"
alias gb="git branch"
alias gba="git branch -a"
alias gs="git status"
alias gca="git commit -a"
alias gcm="git commit -m"
alias gk="gitk --all &amp;"
alias ss="script/server"
alias ssp="script/server -p"
alias sr="script/runner"

</code></pre>
<p>Big credit goes <a title="osx leopard terminal title and tab naming" href="http://pseudogreen.org/blog/set_tab_names_in_leopard_terminal.htm">Christopher Stawarz</a> to the the tab &amp; title thing: l</p>
]]></content:encoded>
			<wfw:commentRss>http://geoff.evason.name/2008/08/19/my-bash_profile-for-git-rails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

