Skip to content

Instantly share code, notes, and snippets.

@jasonyingling
Last active December 20, 2015 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonyingling/6128141 to your computer and use it in GitHub Desktop.
Save jasonyingling/6128141 to your computer and use it in GitHub Desktop.
.bash_profile to display directory location and current git branch. Based off Ollo's .bash_profile here https://gist.github.com/Ollo
Prompt and prompt colors
# 30m - Black
# 31m - Red
# 32m - Green
# 33m - Yellow
# 34m - Blue
# 35m - Purple
# 36m - Cyan
# 37m - White
# 0 - Normal
# 1 - Bold
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
function prompt {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
local RED="\[\033[0;31m\]"
local REDBOLD="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREENBOLD="\[\033[1;32m\]"
local YELLOW="\[\033[0;33m\]"
local YELLOWBOLD="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local BLUEBOLD="\[\033[1;34m\]"
local PURPLE="\[\033[0;35m\]"
local PURPLEBOLD="\[\033[1;35m\]"
local CYAN="\[\033[0;36m\]"
local CYANBOLD="\[\033[1;36m\]"
local WHITE="\[\033[0;37m\]"
local WHITEBOLD="\[\033[1;37m\]"
export PS1="$CYAN\u@\h $YELLOW\w$GREEN\$(parse_git_branch)$WHITE ϟ "
}
prompt
# navigation
alias web='cd ~/sites'
alias ls='ls -aG'
alias compassinit='compass create --bare --sass-dir "sass" --css-dir "css" --javascripts-dir "js" --images-dir "img"'
alias watch="compass watch"
#git shortcuts
alias gc="git checkout"
alias ga="git add ."
alias gm="git merge"
alias commit="git commit -am"
alias pulldev="git pull origin dev"
alias pushdev="git push origin dev"
#MAMP php errors
alias tailphp='tail -f /Applications/MAMP/logs/php_error.log'
#local dns flush
alias flushdns="sudo killall -HUP mDNSResponder"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment