fish: functions/glmd: Add an alias for formatting logs in markdown

Adapted from Heftig's (Jan Alexander Steffens) note on IRC

git config --global alias.mdlog 'log --reverse --pretty=format:"- **%s**  %w(0,2,2)%+b"'

This will format commits in a way that's nice for pasting into MR descriptions,
assuming the commit body is markdown.

Usually used like below

git mdlog @{u}.. | wl-copy
git mdlog origin/main.. | wl-copy
This commit is contained in:
Sanchayan Maity 2023-01-30 12:02:44 +05:30
parent 91cbcbe75f
commit 210fc81fcd
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -0,0 +1,4 @@
function glmd --description 'Format commits in markdown for MR descriptions and copy to clipboard'
set -l remote (git symbolic-ref refs/remotes/origin/HEAD | awk -F'/' '{print $4}')
git log --reverse --pretty=format:"- **%s** %w(0,2,2)%+b" origin/$remote.. | wl-copy
end