git multiple subject prefix with format-patch

1.8k Views Asked by At

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 ..........
2

There are 2 best solutions below

1
J. Titus On

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"
3
CodeWizard On

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