I just hacked my core.pager to show me more usefull log and diff:
[core]
; diff-so-fancy:
; Seperate files in diff view
; LESS_TERMCAP ... +0 -p ...:
; Highlight merge commits and file beginnings in diff view (but do not
; jump because of `+0`), press `n` to jump to the next occurence
; -S:
; Do not break long lines (useful for log --graph with branches)
pager = "diff-so-fancy | LESS_TERMCAP_so=$'\\E[1;37m' less --tabs=4 -RFX +0 -p 'Merge (branch|pull request) .*|^(added|deleted|modified): '"
It's quite cool, but I don't like some behaviour of less. How can I prevent
Pattern not found
message (for example when runninggit diff
on a clean repo)?- redraw of the full screen (
git log --oneline -5
)? - the need of pressing
q
even on half screen messages (because of-S
)?
Note that if you want to use it without diff-so-fancy, then change ^(added|deleted|modified)
to ^diff --git
.
A SIMPLIFIED SOLUTION
pager = "diff-so-fancy | GREP_COLOR='1;37' grep --color=always -E 'Merge (branch|pull request).*|$' | less --tabs=4 -RFX"
It will only highlight merge commits, does nothing more.