3

I wanted to add more then one subject prefix to my patch while using the format-patch option of git.

The subject should look something like

[Qemu-devel] [PATCH] linux-user/qemu.h Changed ..........

How to do this?


Doing

git format-patch --subject-prefix="Qemu-Devel PATCH" .....

Results in

[Qemu-Devel PATCH] linux-user/qemu.h Changed ..........
Haris
  • 11,514
  • 6
  • 36
  • 63
  • From the documentation: By default, the subject of a single patch is "[PATCH] First Line" and the subject when multiple patches are output is "[PATCH n/m] First Line". To force 1/1 to be added for a single patch, use -n. To omit patch numbers from the subject, use -N. – CodeWizard Mar 23 '16 at 18:27

2 Answers2

2

You could do this:

git format-patch --subject-prefix="Qemu-Devel] [PATCH"

The beginning and end square brackets will be added automatically resulting in

Subject: [Qemu-Devel] [PATCH] ...

If you had more than 2 subject prefixes:

git format-patch --subject-prefix="Qemu-Devel] [Something-Else] [PATCH"
J. Titus
  • 8,230
  • 1
  • 27
  • 40
1

You could setup a configuration file for the format-patch

CONFIGURATION
You can specify extra mail header lines to be added to each message, defaults for the subject prefix and file suffix, number patches when outputting more than one patch, add "To" or "Cc:" headers, configure attachments, and sign off patches with configuration variables.

[format]
    headers = "Organization: git-foo\n"
    subjectprefix = CHANGE
    suffix = .txt
    numbered = auto
    to = <email>
    cc = <email>
    attach [ = mime-boundary-string ]
    signoff = true

Set the desired subjectprefix

CodeWizard
  • 92,491
  • 19
  • 110
  • 133