Search this site:

My git tips...

Ok, so a handy meme is loose: Handy Git tips. We even had a crazy anatidae requesting us to post this to the Git wiki whatever we send on this regard to our personal blogs. Following Damog’s post, I will also put my .bashrc snippet: parse_git_branch() { branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` if [ ! -z "$branch" ] then if ! git status|grep 'nothing to commit .working directory clean' 2>&1 > /dev/null then branch="${branch}*" mod=`git ls-files -m --exclude-standard|wc -l` new=`git ls-files -o --exclude-standard|wc -l` del=`git ls-files -d --exclude-standard|wc -l` if [ $mod != 0 ]; then branch="${branch}${mod}M"; fi if [ $new != 0 ]; then branch="${branch}${new}N"; fi if [ $del != 0 ]; then branch="${branch}${del}D"; fi fi fi echo $branch } This gives me the following information on my shell prompt: