I have following aliases in my .gitconfig
to automate my tag annotations (using my git tag-release alias):
[alias]
lm = log --pretty=format:'(%h) %s%n%w(72,10,10)%b%w(72,0,0)by %an on %ad%n' --date=local --no-merges
rn = "!f() { git lm \"${1:-$(git describe --abbrev=0 --tags)}\"..\"${2:-$(git rev-parse HEAD)}\"; }; f \"$@\""
tag-release = "!f() { { echo \"Release $1\n\nChanges:\n\n\"; git rn; } | git tag -a \"$1\" -F -; }; f \"$@\""
My problem is, that because of %w(72,10,10)%b
, my commit body is moved 10 spaces to the right and wrapped at 72 characters, which sometimes gives weirdly formatted tag annotations, because the commit messages themselves contain newlines as well. I was wondering if there's a way to get the commit body, replace the newlines and then wrap that at 72 characters with an indentation of 10? Any help is appreciated!