Git how to save a preset git log –format

In newer versions of Git (confirmed with v1.7.8) it is possible to set named pretty-print log formats using git config pretty.named_format. These can be set at a machine-wide, user or file level with the <file-option> argument.

To create a log format called jespers_favourite or the whole machine use --system

git config --system pretty.jespers_favourite "%h%x09%an%x09%ad%x09%s"

For single user use ‘–global’

git config --global pretty.jespers_favourite "%h%x09%an%x09%ad%x09%s"

Leaving the <file-option> argument blank will default to setting the config file of the current repository, .git/config unless defined otherwise.

Leave a Comment