Some spells
~/.bashrc addtions:
function show {
if [ -z "$1" ]; then
git remote show;
else
git remote show $1|grep -v '^ tags/'
fi
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function parse_git_branch_prompt {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $GREEN$(parse_git_branch_prompt)$BLUE$GREEN\$ '
PS2='> '
PS4='+ '
}
# May already be there...
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
~/.bash_aliases:
alias B='echo $(parse_git_branch)'
alias tracked="git ls-remote -h .|awk '{print $2}'|cut -d'/' -f3|grep -vf ~/.dead-git-branches"
alias working="tracked|grep -v master|grep -v ^rel_"
alias showall='for i in `show`; do show $i; done'
alias lg='git log --pretty=oneline'
alias dif='git diff'
alias co='git checkout'
alias saveb='_PB=`B`'
alias popb='co $_PB;unset _PB'
alias ci='git commit'
alias fetch='git fetch'
alias fetchall='for i in `git remote show`; do git fetch $i; done; git svn fetch'
alias branch='git branch'
alias status='git status'
alias pullmaster='git pull --quiet origin master; show|grep `B`|grep pushes|grep -v "up to date"'
alias pull='git pull'
alias push='git push'
alias pet='saveb; for i in `working`;do co $i; git pull esi $i; push esi; done; popb'
alias upall='saveb; for i in `tracked`; do co $i; echo -n "Pulling $i..."; perl -e "die 0 if \$ARGV[0] =~ /^rel_/" $i 2>/dev/null && (echo "but pulling master first..."; git pull origin master); git pull; done; popb'