Firstly, I just learned about the core.pager option which solves the problems I was solving previously with this ugliness:
ll = "!git --no-pager log --pretty=nice -n30; echo"
Secondly, the %+d. I generally don't use the --graph log formats, (such as these), that show you the branch paths, but seeing where the refs are is super useful. The + makes it appear on the next line without adding a line break when there are no refs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
# -E means don't page if less one screen | |
# -F means quit when EOF reached | |
# -r fixes the %C(yellow)%+d colouring somehow | |
pager = less -E -F -r | |
[alias] | |
ll = log --pretty=nice -n 30 # about one screen worth | |
lll = log --pretty=nice # goes back forever | |
[pretty] | |
# %h is short commit hash | |
# %cr is time ago in words | |
# %cn is committer name | |
# %s is the commit message title | |
# %+d is a line break and a list of refs | |
nice = format:%Cblue%h %Cred%cr %Cgreen%cn%Creset - %s%C(yellow)%+d |
Here's a screenshot of how it looks (with details obscured to protect the innocent).
Update: I dropped the line break before the refs list, which is fine if you have a nice wide terminal, and tweaked some colours. Now it's:
nice = format:%Cblue%h %C(cyan)%cr %Cgreen%an%Creset %s%C(yellow)%d %Creset