How to add additional text when sending an email with git send-email?

前端 未结 3 702
陌清茗
陌清茗 2021-02-08 15:55

I am sending patches using git send-email .

I want that the email sent with the patch to have some additional text added at the top, besid

3条回答
  •  死守一世寂寞
    2021-02-08 16:12

    Documentation says that you can add --compose option to git send-email to "Invoke a text editor to edit an introductory message for the patch series."

    If you want to automate this action and generate some text by your script. You could set $GIT_EDITOR environment variable to your script. It will receive temporary file name for the text in the command line argument. Contents of this file will be inserted into the message after your script exit.

    Command for git send-email will look like:

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

    And your script could look like:

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

提交回复
热议问题