Getting patches from git with diffstat information

Carl Worth cworth at cworth.org
Mon Feb 27 11:31:05 PST 2006


On Mon, 27 Feb 2006 13:35:53 -0500, Adam Jackson wrote:
>
> It would be Really Cool if git could do diffstat summaries automatically; 
> anyone know if this is possible?

git-format-patch does that automatically.

You have to do things slightly differently to use git-format-patch
rather than git-diff, but the difference is actually a "better" way to
work anyway. Namely, rather than leaving important stuff as local
modifications in the working tree, instead commit changes to a local
"topic branch" (and in nice, independent pieces). For example, a basic
workflow might look like:

	git clone git://git.freedesktop.org/git/project
	cd project
	git checkout -b my-topic
	# hack up change #1
	git commit -a -m "This needs to happen first"
	# hack up change #2
	git commit -a -m "And this happens next"
	git format-patch origin

This creates two commits on a local branch named my-topic and spits
out two patch files with the two commits named:

	0001-This-needs-to-happen-first.txt
	0002-And-this-happens-next.txt

Those patches have diffstat content in them and are ready to be mailed
off, (git-send-email can be used for this, or they can be sucked up
into an MUA as a template message to be mailed off).

The recipient of the message can use git-am to apply it directly,
(preserving the author name from the From: header, and the commit
message from the Subject: and the email content until the ---
divider). The portion of the message between the --- divider and the
diffstat can be used by the sender to give meta-information about the
patch that won't actually land in the commit message. For example
things like, "You might not like this patch because of foo, and if
so, let me know and I'll send another," or similar.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20060227/f1de1d28/attachment.pgp>


More information about the xorg mailing list