Skip to content

Instantly share code, notes, and snippets.

@renaco
Last active December 11, 2017 16:09
Show Gist options
  • Save renaco/ae1133f24ef2f36e4538 to your computer and use it in GitHub Desktop.
Save renaco/ae1133f24ef2f36e4538 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 gd='git diff '
alias gr='git remote '
alias gck='git checkout'
alias gb='git branch '
alias gl='git log '
alias gd='git diff '
alias gck='git checkout '
alias gst='git stash '
alias clean_='find . -name '._*' -delete'
alias cleanorig='find . -name '.orig' -delete'
alias cleanbak='find . -name '.bak' -delete'
alias rmf='rm -rf '
alias npmi='npm install '
alias ngrok='./ngrok http '
# 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