“ I beleive in open source philosophy and work in the spirit of it, earning a living by it is simply my dream. „

Send patches using git send-email

by admin last modified Mar 02, 2011 12:22 AM
You decided to use git? nice ... Now really use it :P
Send patches using git send-email

the fast version control system

I'm going to show you how easy it is to setup and send patches from where you write your code. Why is that important? Well in my case I want to bring some attention on mailing list about things I'm working on, before I will commit them and create mess in trunk. Also changes are not that big that I would create new branch for it. Of course I could send very long email explaining with my English, but in most cases it would be nice to send patches with my comments so others can quickly test and see what I really meant without messing up trunk.

Here is where git-send-email comes into play.

Install git with send-email support

Don't want to solve everybody problems here. Probably if you don't have a clue where to setup send-email support it is already included in whatever is your way of installing packages.

This days I'm using Mac OSX 10.6 (pussycat edition). More or less successfully I use nix package manager and its nixpkgs package repository. I'm not going to talk much about this. This is a topic for a some other blogpost. All I can say stay away from macports ...

Here is what I do to install it.

% nix-channel --update
fetching list of Nix archives ...

% echo '{ git = { sendEmailSupport = true; }; }' > ~/.nixpkgs/config.nix
% nix-env -i git
i686-darwin i686-darwin i686-darwin 0
i686-darwin i686-darwin i686-darwin 0
warning: there are multiple derivations named `git-1.7.4'; using the first one
replacing old `git-1.7.3.1'
installing `git-1.7.4'
the following derivations will be built: ...
    ...

% which git
/Users/rok/.nix-profile/bin/git

% nix-env -q --installed "git"
git-1.7.3.1

Of course cool thing about nix is that if something goes wrong there is always rollback and I mean real rollback, not like macports one, where you can only hope things work after.

Well enough about nix, I promise to write more about it ... hopefully this year.

Send email via Gmail

Now lets configure git-send-email to send emails via Gmail. Since i-dont-know which version git supports TLS stuff needed for connecting to Gmail please use latest or at least my version or higher.

% git config --global sendemail.smtpencryption tls
% git config --global sendemail.smtpserver smtp.gmail.com
% git config --global sendemail.smtpuser info@garbas.si
% git config --global sendemail.smtpserverport 587

It'll ask you later for your password when you're sending the emails. And to have a little bit nice patch structure use this option [1], [2], but thats personal decidion.

% git config --global sendemail.chainreplyto false

Integrate adressbook

It would be possible to integrate any kind of addressbook out there, but for now I'm keeping thigs simple. We setup aliases in one file [3].

% git config --global sendemail.aliasesfile ~/.gitaliases
% git config --global sendemail.aliasfiletype mailrc
% echo "plone-devel plone-developers@lists.sourceforge.net" >> ~/.gitaliases

Send emails

Now were are ready to send some mails out right?

% git send-email --to test@garbas.si --annotate --cover-letter master

I really don't have to tell you you can create git aliases for this right? Few times hit OK and mail will be sent. Now it will never happen to you to forget to send your patches upstream. Year right :P

[1]git send-email tricks
[2]making --no-chain-reply-to the default
[3]Installing Git 1.5.2.4 on Mac OS X Leopard