Git send-email - how to add additional text when sending email

I am sending patches using git send-email.

In any case, I want to add additional text at the top in addition to the commit message in the email sent with the patch.

Is there any way to do this?

+4
source share
2 answers

You can use --annotate , and then just add a comment between the two --- patches, this will not affect the patch itself.

Link: https://kparal.wordpress.com/2011/08/03/git-tip-of-the-day-introduction-text-when-emailing-patches/

eg:

 From 7ea3c50fa83950549de11c6834c465bc8f28b52b Mon Sep 17 00:00:00 2001 From: James Laska Date: Mon, 1 Aug 2011 09:53:16 -0400 Subject: [PATCH] compose_tree - Save the setup.sh script for later debugging --- This patch is really really important, because otherwise the world will end in 2012. Please accept it. tests/compose_tree/compose_tree.sh | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/tests/compose_tree/compose_tree.sh b/tests/compose_tree/compose_tree.sh index 66ecefd..c2e041d 100755 --- a/tests/compose_tree/compose_tree.sh +++ b/tests/compose_tree/compose_tree.sh ... (the rest of the patch) 
+3
source

The documentation says that you can add the --compose option in git send-email to "Call a text editor to edit the introductory message for patch series."

If you want to automate this action and generate text using a script. You can set the environment variable $GIT_EDITOR to a script. It will get the temporary file name for the text in the command line argument. The contents of this file will be inserted into the message after the script exits.

The command for git send-email will look like this:

 $GIT_EDITOR="/path/to/your/script" git send-email ... 

And your script might look like this:

 #!/bin/bash echo "Your message" > $1 
+2
source

Source: https://habr.com/ru/post/1385872/


All Articles