Re: [PATCH] cherry-pick: Add an option to prepend a string to the commit message
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:48:57
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
Bobby Powers wrote:
On 06/11/2010 11:28 PM, Jeff King wrote:
quoted
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 -I like this; it clearly hadn't occurred to me. I can just use this format instead.
Sorry to misunderstand. Maybe something like this could help. Patch applies on top of cc/cherry-pick-series. -- %< -- Subject: Documentation: explain use of cherry-pick -n in scripts Add an example to indicate how to munge a commit while cherry-picking it. The formatting is ugly because I do not know how to ask asciidoc to use a multiline heading in a definition list. Based-on-work-by: Jeff King [off-list ref] Signed-off-by: Jonathan Nieder <redacted> ---
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index bcb4c75..4769ca5 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt@@ -113,6 +113,17 @@ git cherry-pick --ff ..next:: are in next but not HEAD to the current branch, creating a new commit for each new change. +------------ +git checkout maint && +git cherry-pick -n bugfix && +git add new_file.txt && +git show -s bugfix --format='%s%n%n%b%n%nAlso add a new file.' | +git commit -F - +------------ + + Apply a bugfix on top of the maint branch and tweak it before + creating a new commit to record it. + Author ------ Written by Junio C Hamano <gitster@pobox.com>
--