Generate a patch to send by email.
Generate a patch from last commit:
git format-patch HEAD~
This generates a file named:
with contents of type:
From 052ebb714e141e6df52e6a942ee353aa522b2f07 Mon Sep 17 00:00:00 2001 From: Ciro Santilli <firstname.lastname@example.org> Date: Tue, 23 Jun 2015 10:06:42 +0200 Subject: [PATCH] Commit message with hyphens Second commit message line. Third one. --- file.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file.txt b/file.txt index 6694b23..6b5b6f1 100644 --- a/file.txt +++ b/file.txt @@ -4205,7 +4205,7 @@ context -4 context -3 context -2 context -1 -old line +new line context 1 context 2 context 3 -- 1.9.1
which is basically a:
a “junk” line with the SHA-1 of the commit, followed by a dummy date. I think the SHA-1 is useless, as it will change when applied because the parent will change.
This can be removed without affecting the apply.
header that encodes the commit author and message
Now send that by email,
Apply Mailed patch generated by
git am 0001-Commit-message-with-hyphens.patch
Creates a new commit.
git diff or
git format-patch patch to the working tree or index with
--index. Does not commit it.
Extra text added to commit messages or only to patches.
Required by certain projects, notably the Linux kernel, because of legal reasons: http://stackoverflow.com/questions/1962094/what-is-the-sign-off-feature-in-git-for
Has no relation to GPG signatures.
Add signed-off by line to the commit message:
git commit -ms 'Message.'
This would generate a commit message like:
Message. Signed-off-by: Super Developer <email@example.com>
Normally you don’t need to pollute the commit message: just add it to the patch sent by email:
git format-patch -s