How can I show the current git branch as part of the Emacs shell
prompt?
For example, I have this in my ~/.bash_profile
(I'm on Mac OSX 10.9 Terminal):
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\033[00m\]\u@\h\[\033[01;33m\] \w \[\033[31m\]\$(parse_git_branch)\[\033[00m\]$\[\033[00m\] "
which produces a nicely colored bash shell like this:
name@my-computer ~/code/sample (master)$
How can I produce something similar in the emacs shell?
Currently when I open M-x shell
it will open like so:
bash: parse_git_branch: command not found
name@my-computer ~/code/sample $