Skip to content

Instantly share code, notes, and snippets.

@dm-z
Last active May 16, 2018 17:20
Show Gist options
  • Save dm-z/249235e25f68fc1759c3 to your computer and use it in GitHub Desktop.
Save dm-z/249235e25f68fc1759c3 to your computer and use it in GitHub Desktop.
.bash_profile with colors, git completion and showing active git branch if available
#Showing user name and current git branch
PS1='\[\e[1;31m\]Mac[\[\e[m\]\[\e[1;32m\]\u\[\e[m\]\[\e[1;31m\]]\[\e[m\] \[\e[1;36m\]\w\[\e[m\]$(__git_ps1 "\[\033[01;33m\] git(\[\e[35m\]%s\[\033[01;33m\])") \[\e[1;32m\]➜ \[\e[m\]'
#Current color scheme - Solarized
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
export GREP_OPTIONS='--color=auto'
#Git aliases
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff | mvim'
alias gau='git add --update'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcot='git checkout -t'
alias gcotb='git checkout --track -b'
alias gchm='git checkout master'
alias grbm='git rebase master'
alias glog='git log'
alias glogp='git log --color --graph --pretty=format:"%C(yellow)%h%Creset -%C(magenta)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit --'
#Path to git and git-completion
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
#Bash options
bind "set completion-ignore-case on"
bind "set show-all-if-ambiguous on"
#Other aliases
alias mvim="open -a MacVim"
alias vim="/Applications/MacVim.app/Contents/MacOS/Vim"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment