Reputation: 7202
I modified gitconfig
to obtain a colorful and easier to read git log
:
[format]
pretty = %C(yellow)%h %C(green)(%cd) %C(reset)%s%C(bold yellow)%d %C(bold cyan)<%an>%C(reset)
The issue is that this formatting also applies to git show
, so I don't have any easy way to read multiple-lines commit messages anymore.
So far, I came up with two annoying solutions:
gitconfig
with this format section and use --pretty=medium
when I want to see multi-lines commit messages.removing the format section from gitconfig
and create aliases for oneline logs:
l = log --decorate --pretty=format:'the whole formatting chain'
ll = log --decorate -p --pretty=format:'the whole formatting chain again'
Is there any shorter or more elegant way to apply this kind of formatting to the log
command only ?
Upvotes: 1
Views: 63
Reputation: 488183
This is distinctly non-pretty and non-elegant, but at least you can tweak the format in one place:
[alias]
l = !git log "--pretty=format:\"$(git config --get myformats.log)\"" --decorate
(add ll
etc., as desired). The quoting above was found by experiment....
[myformats]
log = %C(yellow)%h %C(green)(%cd) %C(reset)%s%C(bold yellow)%d %C(bold cyan)<%an>%C(reset)
Upvotes: 1