dotfiles/fish/.config/fish/functions/glmd.fish
Sanchayan Maity 210fc81fcd
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
2023-01-30 12:26:05 +05:30

5 lines
280 B
Fish

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