One minute
A Simple Bash Style With Git Branch Detection
Files
This could go into .bashrc
, .bash_profile
or .zshrc
- your respective shell config file.
Args
Some aliases for easier handling
# alias shortcuts
alias lla="ls -la"
alias ll="ls -l"
alias l="ls"
Then we need a function which parses the current git branch (git has to be installed)…
# Git branch in prompt.
parse_git_branch()
{
git branch 2> /dev/null |sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
…and input the branch unto your PS1 (current theme) like so:
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
Then I added some more styling for OSX as well as for ls
export CLICOLOR=1
export TERM=xterm-color
export LSCOLORS=gaCxcxdxbxegedabagacad
Misc
And some honorable mentions for OSX as well would be:Add MAMP PHP to your path
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
# export PATH="/usr/local/bin:$PATH"
And add the current locale like German, UTF-8 as well
export LC_ALL=de_DE.UTF-8