Re: [PATCH] cherry-pick: Add an option to prepend a string to the commit message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bobby Powers wrote:
> On 06/11/2010 11:28 PM, Jeff King wrote:

>> 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 <peff@xxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
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@xxxxxxxxx>
-- 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]