6

How to specify 'git send-email' to send mail on a specific patch?

I have 4 commits but I haven't done a 'git pull'. When I do 'git send-email', it will send out 4 emails (1 patch for each commit).

How can I configure git send-email so that it can send out email just for the last commit?

Thank you.

parsley72
  • 8,449
  • 8
  • 65
  • 98
n179911
  • 19,547
  • 46
  • 120
  • 162

3 Answers3

4

git-send-email takes arguments specifying the patches to send. For example,

git send-email HEAD^

will create a patch for the last commit on your current branch. Similarly if you are formatting patches first with git-am, you can specify only the single patch file you want to send.

For more information on how to specify revisions, see man git-rev-list. The common methods you'll probably care about:

  • <commit1>..<commit2> means everything after up to
  • <commit>^ means the commit before <commit>
  • <commit>~5 means the commit five commits before <commit>
Cascabel
  • 479,068
  • 72
  • 370
  • 318
  • Note that git-send-email accepting git-format-patch / git-rev-list parameters is quite new feature (require quite modern git) – Jakub Narębski Aug 06 '09 at 12:21
  • Ah, thanks, Jakub, didn't know that. I'm more of a push-pull guy. I imagine `git-format-patch` has been taking the `git-rev-list` parameters for a while, though, so there should be an alternate solution. – Cascabel Aug 07 '09 at 14:39
  • The variant with commits you advised oesn't work. `git send-email fb1171d274971b5c7984622836fbec1c144e0ea2 --annotate` tries sending 2 patches, and not even single of them is `fb1171d…`. – Hi-Angel Apr 09 '17 at 14:53
2

The question was asking about a "specific patch", so many may come here to find how to send email for a spefic commit, everywhere in the log history. For this case answer may be:

git send-email -1 b7ed62c8d882fecaf70da813a0494b2f8265d544 -to trullallero@tralala.com

Where b7ed62c8d882fecaf70da813a0494b2f8265d544 is the commit i want o send as a single [PATCH] whatever is his position in the log history.

1

IMHO this shoud be working:

git send-email -1
pevik
  • 4,523
  • 3
  • 33
  • 44