Git
Chapters ▾ 2nd Edition

A3.9 Appendix C: Git Commands - Email

Email

Many Git projects, including Git itself, are entirely maintained over mailing lists. Git has a number of tools built into it that help make this process easier, from generating patches you can easily email to applying those patches from an email box.

git apply

The git apply command applies a patch created with the git diff or even GNU diff command. It is similar to what the patch command might do with a few small differences.

We demonstrate using it and the circumstances in which you might do so in Applying Patches from Email.

git am

The git am command is used to apply patches from an email inbox, specifically one that is mbox formatted. This is useful for receiving patches over email and applying them to your project easily.

We covered usage and workflow around git am in Applying a Patch with am including using the --resolved, -i and -3 options.

There are also a number of hooks you can use to help with the workflow around git am and they are all covered in Email Workflow Hooks.

We also use it to apply patch formatted GitHub Pull Request changes in Email Notifications.

git format-patch

The git format-patch command is used to generate a series of patches in mbox format that you can use to send to a mailing list properly formatted.

We go through an example of contributing to a project using the git format-patch tool in Public Project over Email.

git imap-send

The git imap-send command uploads a mailbox generated with git format-patch into an IMAP drafts folder.

We go through an example of contributing to a project by sending patches with the git imap-send tool in Public Project over Email.

git send-email

The git send-email command is used to send patches that are generated with git format-patch over email.

We go through an example of contributing to a project by sending patches with the git send-email tool in Public Project over Email.

git request-pull

The git request-pull command is simply used to generate an example message body to email to someone. If you have a branch on a public server and want to let someone know how to integrate those changes without sending the patches over email, you can run this command and send the output to the person you want to pull the changes in.

We demonstrate how to use git request-pull to generate a pull message in Forked Public Project.

scroll-to-top