Pages

Monday, January 2, 2012

Useful terminal with git in osx

Here's some small modifications how you can get more out of git and bash with OSX (maybe Linux too).

Add following to the .bash_profile:


#for white terminal
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

# Set git autocompletion and PS1 integration
if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then
. /usr/local/git/contrib/completion/git-completion.bash
fi
GIT_PS1_SHOWDIRTYSTATE=true

if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi

PS1='[\u@\h`__git_ps1` \W]\$ '

enjoy.

thanks to:

1 comment:

  1. Anonymous12/3/12 10:58

    Beware that SHOWDIRTYSTATE will make your shell hang with very large repos whenever it prints the prompt. Not relevant here (or indeed in most normal cases) I guess, but e.g. with a full clone of Qt 4 it'll take several seconds even with an SSD, because it's going to stat() every file.

    ReplyDelete