Hacker News new | past | comments | ask | show | jobs | submit login

> It'd be a useful thing to import without having to bring in the whole charade of using email and mailing lists (which most mail clients tend to be very unfavorable of in general nowadays)

This is a misconception. git itself has commands (git-format-patch and git-send-email) that automate the creation of patches and sending changeset email threads to the mailing list. The only thing one needs to do is set the appropriate configuration settings in their git config (which is a one time operation like setting your name and email address).

The actual interaction on the mailing list (responding to those who review patches and changesets can be done in any email client of one's choosing (though it's helpful to use an email client that supports threading using the Message-Id, In-Reply-To and Reference headers rather than one that only handles conversation view style replies).




No, it is not a misconception. How do I apply a patch from gmail to a specific git repo on my computer? (I would genuinely like to know the answer, but it must not involve mutt, gnus, or dovecot!)


Save the email to your local machine (in gmail, click the 3 dots and choose download message). Then run

    git am < saved_email_file.eml


Right, thanks! (And using clipboard and stdin sounds even more convenient for small patches as a sibling comment suggests.)


Copy-paste may not work depending on how the email client renders the email. For example, if the email client doesn't preserve prefixed whitespace, then the resulting patch may be corrupted or not apply. Saving the actual email to a file on disk would avoid that issue.


Copy the content of the email to your clipboard, type `git am` in your terminal, paste and C-d to complete.


OK thanks, that sounds fairly convenient for small patches. And I expect you'd say download the email for larger patches (as a sibling commenter suggests).


In the worst case you can copy paste a patch into a new local file in the repo and then apply it with git from there. I’ve had somebody slack me patches before and it is not a big lift.


Many local mail clients also just let you pipe the message into a command; for example, in mutt, you could just type:

   |git am
once you have the message open.


You may have a skewed idea of “most” here.

Most people are using gmail, but when it comes to local clients, Outlook, Apple Mail and Thunderbird are by far the most common and as far as I know none of them support this without extra steps.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: