Skip to content

Instantly share code, notes, and snippets.

@swlkr
Created February 20, 2016 21:19
Show Gist options
  • Save swlkr/667bd5e16ca4b6f4f098 to your computer and use it in GitHub Desktop.
Save swlkr/667bd5e16ca4b6f4f098 to your computer and use it in GitHub Desktop.
.bash_profile
#!/usr/bin/env bash
# Get the Git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Custom bash prompt
#
# Includes custom character for the prompt, path, and Git branch name.
#
# Source: kirsle.net/wizards/ps1.html
export PS1="\n\[$(tput bold)\]\[$(tput setaf 5)\]\[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\$(parse_git_branch) \[$(tput sgr0)\] $ "
export PATH=/Users/seanwalker/.local/npm:/Users/seanwalker/.local/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin:/opt/nginx/sbin:$PATH
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
export PATH=/opt/local/bin:/opt/local/sbin:${PATH}
# Set my editor and git editor
export EDITOR='/usr/bin/vim'
export GIT_EDITOR='/usr/bin/vim'
# Don't check mail when opening terminal.
unset MAILCHECK
alias ss='open -a /System/Library/Frameworks/ScreenSaver.framework//Versions/A/Resources/ScreenSaverEngine.app'
alias copy="tr '\n' ' ' | pbcopy"
alias password="pwgen 10 7 | tr '\n' ' ' | pbcopy"
alias lf="lein figwheel"
## Shortcuts
alias ll='ls -al'
alias resource='source ~/.bash_profile && echo "Done!"'
## Git commands
alias log='git log'
alias diff='git diff'
alias branch='git branch'
alias gst='git status'
alias fetch='git fetch'
alias push='git push origin head'
alias pull='git pull'
alias recent='git for-each-ref --sort=-committerdate refs/heads/'
## Git branch switching
alias master='git co master'
## Switch repos
DIR=~/Projects
alias h='cd ~/'
alias p='cd ${DIR}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment