From: Stephan Beyer <s-beyer@gmx.net>
To: Marvin Fraeman <marvin.fraeman@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: How do I control the automated commit message on a merge?
Date: Wed, 4 Jun 2008 09:33:17 +0200 [thread overview]
Message-ID: <20080604073317.GA7752@leksak.fem-net> (raw)
In-Reply-To: <bd2cb52a0806031705x7cc153bsc00e1a0198d6e7b5@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1566 bytes --]
Hi,
> >> when Git does a merge (no conflicts), it auto-generates a commit message
> >> like:
> >>
> >> Merge branch 'master' of /path/to/other/repo
> >>
> >> How can I change this so my required string gets written at the
> >> beginning of the commit message.
> >
> > s/./?/
>
> Where do I do the substitution in this case?
In the question that you sent to the list ;-)
(But something like s/\./?/ makes more sense.)
The real answer of Johannes to your question was only:
> You might be happy with a post-merge hook amending the commit with a
> completely different message.
Meaning, you should put something like
#!/bin/sh
git commit -m "This is my new commit message." --amend
or better:
#!/bin/sh
git commit --amend -m "$(git cat-file commit HEAD |
sed -e '1,/^$/d;s/^/YOUR SIMPLE STATIC STRING HERE\n\n/')"
into .git/hooks/post-merge (and make it executable).
YOUR SIMPLE STATIC STRING HERE is the new first line.
Replace the \n\n by a space to get someting like
"YOUR SIMPLE STATIC STRING HERE Merge foo into HEAD."
> Also, having the prepare-commit-msg hook add text had the side-effect
> that in my normal commits, the message was always accepted, even when
> I wanted to abort (vi using :q!).
Let the commit-msg hook add the text afterwards.
Or remove the prepared commit message in vi and then press :x (or :wq),
because commit aborts on an *empty* commit message and not on
an unchanged commit message.
Regards,
Stephan
--
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2008-06-04 7:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-03 21:55 How do I control the automated commit message on a merge? Marvin Fraeman
2008-06-03 22:51 ` Johannes Schindelin
2008-06-04 0:05 ` Marvin Fraeman
2008-06-04 7:33 ` Stephan Beyer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080604073317.GA7752@leksak.fem-net \
--to=s-beyer@gmx.net \
--cc=git@vger.kernel.org \
--cc=marvin.fraeman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).