Skip to content

Latest commit

 

History

History
127 lines (86 loc) · 3.69 KB

2_git_send_email_cover_letter.md

File metadata and controls

127 lines (86 loc) · 3.69 KB

Home Index Back Next

Cover Letter with Patch-Series

To see how to use git send-email, visit here.

Note: Anything wirtten after # is a comment. Even, terminal commands written after it are also comments. This may be used to display outputs in code blocks or to explain the usage of a commnd, in this case the output in your terminal will obviously will not contain #, it is just for presentation.


Option: --cover-letter to include a cover letter in patch series.

Normally, when we create patch, for example

git format-patch -2

It means to create patches of last two commits. Here,

  1. [PATCH 1/2] - Means second last commit.
  2. [PATCH 2/2] - Means last commit.

But when we use --cover-letter option, it creates:

  1. [PATCH 0/2] - For Cover Letter.

There are 2 ways to send your patch-series with cover letter:


1) - $ git format-patch --cover-letter

To create patch series with a cover letter. For ex:

Step 1 : Create Patch-Series

git format-patch -3 -v2 --cover-letter -o ~/development/PATCH/linux

Thus three files will be created inside ~/development/PATCH/linux.

ls

# v2-0000-cover-letter.patch
# v2-0001-pcnet32-Convert-to-generic-power-management.patch
# v2-0002-amd8111e-Convert-to-generic-power-management.patch
# v2-0003-amd-xgbe-Convert-to-generic-power-management.patch

The cover letter looks like this:

vim v2-0000-cover-letter.patch

# From 5292d5c4bd0acb101dd2c2b47e131cc8650bb59c Mon Sep 17 00:00:00 2001
# From: Vaibhav Gupta <[email protected]>
# Date: Mon, 22 Jun 2020 16:32:53 +0530
# Subject: [PATCH v2 0/3] *** SUBJECT HERE ***
#
# *** BLURB HERE ***
#
# Vaibhav Gupta (3):
#   pcnet32: Conver.....

You can edit the Cover letter there. You can also include "To:" and "CC:" in the cover letter, so you don't have to mention it in commandline while sending them. For ex:

# From 5292d5c4bd0acb101dd2c2b47e131cc8650bb59c Mon Sep 17 00:00:00 2001
# From: Vaibhav Gupta <[email protected]>
# To: Bjorn Helgaas <[email protected]>
# To: "David S. Miller" <[email protected]>
# Cc: [email protected]
# Cc: [email protected]
# Date: Mon, 22 Jun 2020 16:32:53 +0530
# Subject: [PATCH v2 0/3] ethernet: amd: Convert to generic power management

# Linux Kernel

Step 2 : Send Patch-Series

git send-email --to-cover --cc-cover ~/development/PATCH/linux/*.patch

Now, when I edited cover letter, I included 'To :' and 'Cc :' in it.

  • --to-cover : If this is set, emails found in To: headers in the first patch of the series (typically the cover letter) are added to the to list for each email set.

  • --cc-cover : If this is set, emails found in Cc: headers in the first patch of the series (typically the cover letter) are added to the cc list for each email set.


2) - $ git send-email --cover-letter

To create patch series with a cover letter. For ex:

git send-email -2 -v1 --cover-letter --to="[email protected]" --cc="[email protected]"

But this throws error:

# Refusing to send because the patch
# 	/tmp/ffNzhikwdO/v1-0000-cover-letter.patch
# has the template subject '*** SUBJECT HERE ***'. Pass --force if you really want to send.

So, use --force option.

git send-email -2 -v1 --cover-letter --to="[email protected]" --cc="[email protected]" --force

It will ask for various options before sending it. Enter e to edit the cover letter. The editing of cover letter is similar as it was done in 1.