Re: Configure default merge message
flat view
From: Jeff King <hidden>
Date: 2021-03-24 22:42:33
On Wed, Mar 24, 2021 at 01:01:42PM -0700, Junio C Hamano wrote:
quoted
I'd like to configure git to omit the "of https://bitbucket.org/repository-name" part. How can I do that?Ævar, is this something we recently made it impossible with 4e168333 (shortlog: remove unused(?) "repo-abbrev" feature, 2021-01-12), or is there more to it than resurrecting that "feature" to do what Jost seems to want?
IIRC, in that earlier discussion Linus said he used a prepare-commit-msg
hook these days instead of repo-abbrev. And it should be able to handle
this case, as well.
Something like this seems to work for me:
$ cat .git/hooks/prepare-commit-msg
#!/bin/sh
case "$2" in
merge)
perl -i -pe '
s{Merge (.*) of https://github.com/gitster/git}{Merge $1}
' "$1"
;;
esac
$ git pull https://github.com/gitster/git next
[...]
$ git log -1 --format=%s
Merge branch 'next'
-Peff