Developer

phoen1x

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"
GIT_USER_EMAIL="john.smith@email-address.local"

# diff and merge tool:  vimdiff, meld, k3diff, ...
GIT_DIFF_MERGE_TOOL="vimdiff"

# set editor: vim, gedit, atom, eclipse, ...
GIT_EDITOR="vim"

#------------------------------------------------

# set user
git config --global user.name "$GIT_USER_NAME"
git config --global user.email "$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 alias.ls '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 ...