Skip to content

Commit

Permalink
git branch in shell prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Aug 25, 2011
1 parent ea54e9f commit 13e8082
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bashrc
@@ -1,3 +1,5 @@
export CLICOLOR=1

# Given an array GO_SHORTCUTS defined elsewhere with pairs shorcut -> directory:
#
# GO_SHORTCUTS=(
Expand Down Expand Up @@ -28,7 +30,7 @@ function go {

# Uncompresses the given tarball, and cds into the uncompressed directory:
#
# fxn@halmos:~/tmp$ xcd ruby-1.9.2-p0.tar.gz
# fxn@halmos:~/tmp$ xcd ruby-1.9.2-p0.tar.gz
# fxn@halmos:~/tmp/ruby-1.9.2-p0$
#
# Accepts tar.gz, tar.bz2, and zip.
Expand Down Expand Up @@ -102,3 +104,8 @@ function rl {
# Reboots Passenger.
alias rb='touch tmp/restart.txt'

# Git branch in shell prompt.
function parse_git_branch {
git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\u@\h:\w \$(parse_git_branch)\$ "

0 comments on commit 13e8082

Please sign in to comment.