我正在使用补丁发送补丁git send-email <patch-name>.
我希望通过补丁发送的电子邮件除了提交消息之外还在顶部添加了一些额外的文本.
有没有办法做到这一点?
小智 5
您可以使用--annotate,然后在两个---补丁之间添加您的评论,它不会影响补丁。
参考:https : //kparal.wordpress.com/2011/08/03/git-tip-of-the-day-introduction-text-when-email-patches/
例如:
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)
Run Code Online (Sandbox Code Playgroud)
文档称您可以添加--compose选项git send-email“调用文本编辑器来编辑补丁系列的介绍性消息”。
如果您想自动执行此操作并通过脚本生成一些文本。您可以$GIT_EDITOR为脚本设置环境变量。它将接收命令行参数中文本的临时文件名。脚本退出后,该文件的内容将被插入到消息中。
命令git send-email如下所示:
$GIT_EDITOR="/path/to/your/script" git send-email ...
Run Code Online (Sandbox Code Playgroud)
你的脚本可能如下所示:
#!/bin/bash
echo "Your message" > $1
Run Code Online (Sandbox Code Playgroud)