git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 3 of 6 in “Configure default merge message”
  1. jost.schulte@tutanota.comMar 24, 2021
  2. Junio C HamanoMar 24, 2021
  3. Jeff KingMar 24, 2021
  4. Ævar Arnfjörð BjarmasonMar 25, 2021
  5. jost.schulte@tutanota.comMar 26, 2021
  6. Ævar Arnfjörð BjarmasonMar 26, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.