Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git send-email subject doesn't change despite --subject option

Tags:

git

I'm trying to set the subject of a patch I'm sending manually, but for some reason it always picks the subject of the patch commit instead of the one I supply to it.

I'm running it as

git send-email --compose --subject="blah" file.patch

and even though I can see the subject "blah" in the editor window that opens, after I save it and attempt to email the patch the subject that is mailed is still the same as the patch commit message.

What am I doing wrong?

like image 716
EpsilonVector Avatar asked Nov 03 '11 08:11

EpsilonVector


People also ask

How do I change the email subject of a Git project?

The repository name in the email subject is the first line of $GIT_DIR/description. Change the first line of the description file to you project’s name. Change the config file The sender’s email address, the mail list and the subject prefix is defined in GIT_DIR/config file.

How does --compose work in Git send-email?

When --compose is used, git send-email will use the From, Subject, and In-Reply-To headers specified in the message. If the body of the message (what you type after the headers and a blank line) only contains blank (or GIT: prefixed) lines the summary won't be sent, but From, Subject, and In-Reply-To headers will be used unless they are removed.

How do I edit a Git send-email before sending?

Use the --annotate option with git send-email to be able to edit the mails before they are sent. Instead of using the --annotate option, one can first run "git format-patch" to create text file (s) (with the -o option to select a directory where the text files are stored).

How do I edit an introductory message in Git?

Invoke a text editor (see GIT_EDITOR in git-var [1] ) to edit an introductory message for the patch series. When --compose is used, git send-email will use the From, Subject, and In-Reply-To headers specified in the message.


1 Answers

You're not doing anything wrong: --compose tells git send-email that you want to write a "cover letter" with the subject you gave with --subject. The actual commit will then be sent as a reply to this "cover letter", with the first line of the commit message as a subject.

This is the "standard format" that is understood by git am so that the recipient can apply the patch and get the same result. This means that changing the subject of the patch email will change the commit message: your recipient would get a different commit, which is probably not what you want.

If you really want to send a commit by email with a custom subject, you can prepare your patch with git format-patch and then attach it to an email written with your usual MUA. This way the recipient can git am the attachment.

like image 156
Schnouki Avatar answered Oct 23 '22 03:10

Schnouki