We can use the convenient git send-email command and specifying a file or a directory of files to send. For example, git send-email .
will send all the files in the current directory.
Let’s assume that we have some patches files which are generated by git format-patch command in the current directory like this:
total 112
-rw-r--r-- 1 administrator staff 678B Sep 3 10:55 0001-Change-pink-to-a-manly-color.patch
-rw-r--r-- 1 administrator staff 815B Sep 3 10:55 0002-Add-a-pink-block-of-color.patch
drwxr-xr-x 5 administrator staff 160B Aug 31 07:50 about
-rw-r--r-- 1 administrator staff 315B Aug 31 07:48 blue.html
...
Git also requires some special configurations for this command:
- Edit
~/.gitconfig
to specify your account settings:
[sendemail]
smtpEncryption = tls # tls is better than ssl
smtpServerPort = 587 # If you choose ssl, this should be 465
smtpServer = <smtp.gmail.com> # You can also use another email provider.
smtpUser = <your-username-to-send-email> # This must be identical to the <Form> email address in your patch files.
From May 30, 2022, you must have multi-factor authentication set up on your Gmail account and generate an app-specific password for use with git send-email. Visit security.google.com/settings/secur... to create it.
Once your commits are ready to be sent to the mailing list, run the following commands:
$ git send-email ./*.patch
The first time you run it, you will be prompted for your credentials. Enter the app-specific or your regular password as appropriate.
If you don’t want to type it the next time, you have to configure credential helper:
Find a helper.
$ git help -a | grep credential- credential-foo
Read its description.
$ git help credential-foo
Tell Git to use it.
$ git config credential.helper foo
References
本作品採用《CC 協議》,轉載必須註明作者和本文連結