Re: Configure default merge message
- From
Jeff King <peff@peff.net>
- Date
- Mar 24, 2021, 22:41 UTC
- Message-ID
- <YFvAJU3Euxhjb+uw@coredump.intra.peff.net>
- In-Reply-To
- <xmqqk0pwxqvt.fsf@gitster.g>
On Wed, Mar 24, 2021 at 01:01:42PM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> > 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