Colorize git messages

error: git-checkout-index: unable to create file public/media/uploads/pdf/dummy1.pdf (Permission denied)
error: git-checkout-index: unable to create file public/media/uploads/pdf/dummy2.pdf (Permission denied)
fatal: merging of trees 78c30151ebcf0866a8bb0b0ad82dc9cf9e0b697a and 7cf25a39a86b53564eed4b9c11b281033693c1e5 failed
Merge with strategy recursive failed.

In order to colorize the error messages (red please) of git you can edit your ~/.bash_profile

HIGHLIGHT=`echo -e ‘\033[31m\033[1m’`
NORMAL=`echo -e ‘\033[0m’`
alias gpull=”git pull 2>&1 | sed -E -e ‘s/error:|warning:|fatal:/$HIGHLIGHT&/’; echo $NORMAL; ./ collectstatic –noinput; ./ syncdb; ./ migrate –list; echo ‘*** git pull: DONE *** collect static: DONE *** syncdb: DONE *** migrations available? *** apply migrations manually!'”
alias gpush=”git push 2>&1 | sed -E -e ‘s/error:|warning:|fatal:/$HIGHLIGHT&/’; echo $NORMAL; maintenance/”
# alias gcomm=”git commit -a; maintenance/”
alias gcomm=”git commit -a;”
alias dumpd=”./ dumpdata >fixtures/all.json –indent 4″
alias loadd=”./ loaddata fixtures/all.json”

alias runserver=”./ create_sample_data; ./ runserver_plus –cert cert COMPUTERNAME.local:8000″
alias runserverhttp=”./ create_sample_data; ./ runserver_plus COMPUTERNAME.local:8000″
alias runserverorig=”./ runserver COMPUTERNAME.local:8000″

alias shell=”./ shell_plus”

#alias syncdb=”./ syncdb –verbosity 2″
alias syncdb=”./ syncdb”
alias dbinit=”./”
alias editmsgs=”nano locale/de/LC_MESSAGES/django.po”
alias makemsgs=” makemessages -a –no-location –extension=html,txt; makemessages –no-location -d djangojs -a”
alias compilemsgs=” compilemessages”
alias clearthumbs=”./ thumbnail cleanup; ./ thumbnail clear; echo ‘Server neu starten damit die Thumbnails neu erzeugt werden!'”

#alias unittest=”./ test”
# Das jeweilige Projekt definiert was genau getestet werden soll:
alias unittest=”./”

git itself also supports colors – e.g. for files that are not yet added to the repository. edit .git/config like this:

branch = always
diff = always
grep = always
interactive = always
pager = true
showbranch = auto
status = auto
ui = always

[color “interactive”]
error = red bold

[color “branch”]
current = yellow reverse
local = yellow
remote = green

[color “diff”]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold

[color “status”]
added = yellow
changed = green

Leave a Reply

Your email address will not be published.

For spam filtering purposes, please copy the number 4935 to the field below: