Skip to content

Instantly share code, notes, and snippets.

@renaco
Last active June 19, 2017 21:15
Show Gist options
  • Save renaco/7fe8bf00331e17b446e0 to your computer and use it in GitHub Desktop.
Save renaco/7fe8bf00331e17b446e0 to your computer and use it in GitHub Desktop.
.bash_profile
export PATH=~/bin:$PATH
export PATH="/usr/local/mysql/bin:$PATH"
# git bash auto-completion
source `brew --prefix git`/etc/bash_completion.d/git-completion.bash
# latest versions of git has the prompt stuff on an extra file
__git_prompt_file=`brew --prefix git`/etc/bash_completion.d/git-prompt.sh
if [ -f "$__git_prompt_file" ]
then
source $__git_prompt_file
fi
# alias 'git' to 'g'
alias g='git'
alias gs='git status'
alias gc='git commit -m '
alias ga='git add '
alias gb='git branch '
alias gck='git checkout '
alias gr='git remote '
# Autocomplete g command too
complete -o default -o nospace -F _git g
# very useful git related methods
function current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
function gpull() {
git pull $1 $([[ $2 ]] && echo $2 || echo origin $(current_branch))
}
function gpush() {
git push $1 $([[ $2 ]] && echo $2 || echo origin $(current_branch))
}
Color_Off="\[\033[0m\]" # text reset
IBlack="\[\033[0;90m\]" # black
IRed="\[\033[0;91m\]" # red
IGreen="\[\033[0;92m\]" # green
IYellow="\[\033[0;93m\]" # yellow
# time vars
Time12h="\T"
PathShort="\w"
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWSTASHSTATE=true
export PS1="${IBlack}${Time12h}${Color_Off} \$(declare -F __git_ps1 &>/dev/null && __git_ps1 '(%s) ')${IYellow}${PathShort}${Color_Off} \$ "
##
# Your previous /Users/CurrentUser/.bash_profile file was backed up as /Users/CurrentUser/.bash_profile.macports-saved_2014-10-20_at_18:34:45
##
# MacPorts Installer addition on 2014-10-20_at_18:34:45: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment