Skip to content

Instantly share code, notes, and snippets.

@daverau-optimizely
Created February 17, 2018 18:57
Show Gist options
  • Select an option

  • Save daverau-optimizely/5eaa8facd49f071e123c0c0c49655644 to your computer and use it in GitHub Desktop.

Select an option

Save daverau-optimizely/5eaa8facd49f071e123c0c0c49655644 to your computer and use it in GitHub Desktop.
~/.bash_profile
# -----------
# Custom aliases for folders
# -----------
alias oui='cd ~/Sites/oui'
# -----------
# History forever
# -----------
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
HISTFILESIZE=-1
# -----------
# Show branch in $ prompt
# -----------
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] → "
# -----------
# Git autocompletion
# -----------
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# -----------
# Git shortcuts
# -----------
alias gu='git checkout master && git pull && git checkout devel && git pull'
alias gb='git for-each-ref --sort=committerdate refs/heads/ --format="%(HEAD) %(color:black)%(objectname:short)%(color:reset): %(color:green)%(refname:short)%(color:reset) - %(contents:subject) (%(color:yellow)%(committerdate:relative)%(color:reset))"'
alias gs='git status '
alias gd='git diff '
alias co='git checkout '
alias gundo='git reset --soft HEAD~'
alias gredo='git reset HEAD@{1}'
alias cod='git checkout devel'
alias gp='git push'
# Turns `gac this is a test message` into `git commit -m "this is a test message"`
function gac() {
git add . && git commit -a -m "$*"
}
# Turns `gc this is a test message` into `git commit -a -m "this is a test message"`
function gc() {
git commit -m "$*"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment