I am currently working on a small assignment from an extra course in college. The task is to write a small program that does some work x, and a Makefile for it. We are to send the two files as a plain text email to our lecturer. We are then required to make a few changes to the program and send the changes as a patch to the first email. We are required to do this again.
Something like this:
program1 |--> patch for change2 |--> patch for change3
While i have no issues with the programming part, i'm having difficulty understanding how i could achieve this through git send-email. A detailed elucidation of the process for a beginner would be very much appreciated.
Now you've asked some specific questions:
This is more of an email question that a
git
question. Emails are generally "linked" by replying to a previous message; in most clients, such a chain of replies will be displayed as a "thread" of conversation.So after sending the first email, you would reply to it, possibly modifying the subject, and include the contents of the first patch (generated with
git format-patch
), and similarly for the second patch.You can actually do this from the command line using
git format-patch
andgit send-email
. First generate your patches:Then use
git send-email
to send these patches, taking advantage of the--in-reply-to
command line option to link your messages to a previous message. This takes the message-id from a previous message as an argument, so you would need to look at your original message to get the value of themessage-id
header. Then you could run:This will send two emails the subjects of which will look like:
And:
For each email,
git
will prompt you whether or not you want to send it:The first will be a reply to the original message, and the second patch will be a reply to the first. In my mail client, this looks like:
(Note that for git to successfully send email you may need to provide it with some configuration. If it doesn't Just Work,
git help send-email
is the place to start.)