Skip to content

Instantly share code, notes, and snippets.

@mattscilipoti
Created March 9, 2012 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattscilipoti/2007687 to your computer and use it in GitHub Desktop.
Save mattscilipoti/2007687 to your computer and use it in GitHub Desktop.
alias gst='git status '
alias gc='git commit '
alias gca='git commit -a '
alias ga='git add '
alias gco='git checkout '
alias gb='git branch '
alias gd='git diff '
alias gm='git merge '
alias gmm='git merge master'
alias gcom='git checkout master'
alias gpom='git push origin master'
alias svnpull='git svn rebase'
alias svnpush='git svn dcommit'
# auto complete bash aliases
# see: http://blog.ericgoodwin.com/2008/4/10/auto-completion-with-git
complete -o default -o nospace -F _git gb
complete -o default -o nospace -F _git gco
# hitch
hitch() {
command hitch "$@"
if [[ -s "$HOME/.hitch_export_authors" ]] ; then source "$HOME/.hitch_export_authors" ; fi
}
alias unhitch='hitch -u'
# Uncomment to persist pair info between terminal instances
# hitch
# git-achievements
export PATH="$PATH:/Users/matt/bin/git-achievements"
alias git="git-achievements"
# Prompt:
# see: https://gist.github.com/1419347
function git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/';
}
function git_status {
git diff --quiet HEAD &>/dev/null
[[ $? == 1 ]] && tput setaf 1 || tput setaf 2
}
# tput +
# sgr 0 = default color;
# setaf = foreground; setab = background;
# 0 = black; 1 = red; 2 = green; 3 = yellow; 4 = blue; 5 = purple; 6 = cyan; 7 = light gray;
# prompt becomes red if git working directory has modified files
# otherwise it's green
## INFO: wrap colors in \[foo\] to fix to line wrap issues.
export PS1="\W\[\$(git_status)\]\$(git_branch)\[\$(tput sgr 0)\]$ ";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment