config/git: improve log viewing experience
This commit is contained in:
parent
7910821c3f
commit
b5aa87edac
|
@ -296,7 +296,6 @@ Version 2019-11-04 2021-02-16"
|
|||
|
||||
;; Org startup - https://orgmode.org/manual/In_002dbuffer-Settings.html
|
||||
(setq org-startup-folded 'show2levels
|
||||
org-startup-with-inline-images t
|
||||
org-display-remote-inline-images 'cache)
|
||||
|
||||
;; Fix xdg-open & pdfs - https://depp.brause.cc/dotemacs/#orgd97f08c
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
#dir = !git root | sed 's/$/\\/.git/' | grep --color=never "/" # grep ensures a proper exit status on fail
|
||||
|
||||
lg = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --graph
|
||||
lgo = lg HEAD @{push}
|
||||
lo = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --no-merges
|
||||
lp = log -p --date=local
|
||||
ln = !git --no-pager lo "-$(a=$(git rev-list --count HEAD...@{push} 2>/dev/null); expr $a + 3 \\& ${a:-0} \\> 4 \\| 7)" --color=always --graph HEAD @{u} 2>/dev/null | head -9 || git --no-pager lo -7
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/zsh
|
||||
# Log local and upstream commits side by side
|
||||
# Useful when the history has been manipulated
|
||||
loc="$(git ln --color=always "$@")"
|
||||
upstream="$(git ln --color=always @{push} "$@")"
|
||||
loc="$(git lo --color=always "$@")"
|
||||
upstream="$(git lo --color=always @{push} "$@")"
|
||||
a=$(echo $loc | wc -l)
|
||||
b=$(echo $upstream | wc -l)
|
||||
halfcols="$(expr $(tput cols) / 2)"
|
||||
for i in $(seq 1 $(test $a -le $b && echo "$a" || echo "$b")); do
|
||||
printf "%-${halfcols}s $(test $halfcols -lt 100 && echo '\\n')%s\n" "$(echo $loc | head -n $i | tail -1)" "$(echo $upstream | head -n $i | tail -1)"
|
||||
# use columns instead? - need to interleave!
|
||||
done
|
||||
done | ${PAGER:-less}
|
||||
|
|
Loading…
Reference in New Issue