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; ./manage.py collectstatic –noinput; ./manage.py syncdb; ./manage.py 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/update_server.sh”
# alias gcomm=”git commit -a; maintenance/utest.py”
alias gcomm=”git commit -a;”
alias dumpd=”./manage.py dumpdata >fixtures/all.json –indent 4″
alias loadd=”./manage.py loaddata fixtures/all.json”

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

alias shell=”./manage.py shell_plus”

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

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


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

[color]
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. Required fields are marked *

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