How to make git log decorate by default

git config log.decorate auto

For a global setting, add the --global parameter.

So it would be:

git config --global log.decorate auto

The aliases are made with git config alias.lg "log --decorate"


Update April 2017, 3 years later:

With Git 2.13 (Q2 2017), no need for configuration: --decorate is the default!

See commit 940a911 (24 Mar 2017) by Alex Henrie (alexhenrie).
(Merged by Junio C Hamano -- gitster -- in commit d9758cf, 11 Apr 2017)

The default behaviour of "git log" in an interactive session has been changed to enable "--decorate".

That means you would need to override that option on command line, to get back to the old behavior (for just one log execution):

git -c log.decorate=false log

Original answer (mid 2014)

Note: since git 2.1.0-rc0 (July 2014), Linus Torvalds himself introduced a decorate=auto option.
That is more precise than just decorate=true, especially for scripting purpose, as explained below.

See commit 1571586 by Linus Torvalds (torvalds):

This works kind of like "--color=auto" - add decorations for interactive use, but do not change defaults when scripting or when piping the output to anything but a terminal.

You can use either

[log]
     decorate=auto

in the git config files, or the "--decorate=auto" command line option to choose this behavior.

Tags:

Git

Git Log