A clever man solves a problem, a wise man avoids it.
— Albert Einstein

Git colored command line

22nd of April 2000

Picture git_ls_colored

# set color
git config --global color.ui auto

# list your history in color
git log --pretty=format:"%C(yellow)%h%C(red)%d %C(green)%s %C(blue)[%cn<%cE> on %ad]" --decorate --numstat --date=short

My git configuration

GIT_USER_NAME="John Smith"

# diff and merge tool:  vimdiff, meld, k3diff, ...

# set editor: vim, gedit, atom, eclipse, ...


# set user
git config --global "$GIT_USER_NAME"
git config --global "$GIT_USER_EMAIL"

# default push
git config --global push.default matching
git config --global branch.master.remote origin
git config --global branch.master.merge refs/heads/master

# set postbuffer for large files 512MB
git config --global http.postBuffer 524288000

# set editor
git config --global core.editor "$GIT_EDITOR"

# set color
git config --global color.ui auto

# set merge tool
git config --global merge.tool "$GIT_DIFF_MERGE_TOOL"
git config --global mergetool.prompt false
git config --global mergetool.keepBackup false

# set diff tool
git config --global diff.tool "$GIT_DIFF_MERGE_TOOL"
git config --global difftool.prompt false

# set aliases
git config --global alias.tree 'log --all --graph --decorate --oneline --simplify-by-decoration'
git config --global alias.unstage 'reset HEAD --'
git config --global 'log --pretty=format:"%C(yellow)%h%C(red)%d %C(green)%s %C(blue)[%cn<%cE> on %ad]" --decorate --numstat --date=short'

# list config
git config --list

Git aliases test

# test ls
git ls

# test tree
git tree

# test unstaging
echo "test" > test.txt
git add test.txt
git status
git unstage
git status

Back ...