From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Bobby Powers <bobbypowers@gmail.com>,
git@vger.kernel.org, gitster@pobox.com,
Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH] cherry-pick: Add an option to prepend a string to the commit message
Date: Sat, 12 Jun 2010 02:28:12 -0400 [thread overview]
Message-ID: <20100612062812.GA12685@coredump.intra.peff.net> (raw)
In-Reply-To: <20100612055831.GA2426@burratino>
On Sat, Jun 12, 2010 at 12:58:32AM -0500, Jonathan Nieder wrote:
> I would be interested to hear from those who might know whether
> something generic like the applypatch-msg hook could work (which is
> not to say a convenient command-line option would not be handy to have
> in addition to that.)
What bothers me is how specific this munging is. What if I want to
append to the message? Or put something after the subject line, but
before the commit body? Or add a pseudo-header (like signed-off-by) to
the set of pseudo-headers at the end, properly adding a newline if it is
the first such pseudo-header.
FWIW, we can already do this kind of stuff with:
GIT_EDITOR="sed -i 1i$prefix" git cherry-pick -e $ref
or
git cherry-pick -n $ref &&
sed -i 1i$prefix .git/MERGE_MSG
GIT_EDITOR=true git commit
I'll admit the first one is not very intuitive. But it is easy to script
around the second form. For one of my examples, I would probably do:
git cherry-pick -n $ref &&
git log -1 --format='%s%n%ncontent between subject and body%n%b' |
git commit -F -
The specifics aren't important, but I think you can see that the "don't
commit automatically, make a message as you like, and then use the
regular message-specifiers for commit to commit it" technique is pretty
straightforward and very flexible.
It's obviously more typing for occasional interactive use, but in that
case, why not just use "git cherry-pick -e" and use your editor?
-Peff
next prev parent reply other threads:[~2010-06-12 6:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-12 5:07 [PATCH] cherry-pick: Add an option to prepend a string to the commit message Bobby Powers
2010-06-12 5:58 ` Jonathan Nieder
2010-06-12 6:18 ` Junio C Hamano
2010-06-12 6:28 ` Jeff King [this message]
2010-06-12 6:43 ` Bobby Powers
2010-06-12 7:18 ` Jonathan Nieder
2010-06-12 8:19 ` Jeff King
2010-06-14 5:33 ` Junio C Hamano
2010-06-14 18:03 ` Junio C Hamano
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=20100612062812.GA12685@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=bobbypowers@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@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).