Re: Quick question: how to generate a patch?

From: Andreas Ericsson <>
Date: 2006-02-28 02:28:04
Aubrey wrote:
> Hi all,
> I'm a newbie of git. I have a question about how to generate a patch by git.
> I want to make a patch againt git repository HEAD. So in my local
> tree, I do the command:
> git diff -p > my.patch
> The file my.patch is generated. But the unchanged files information is
> also included in the patch file. It should be quiet.
> Was I wrong to use git by this way?
> Thanks for your hints.

The current best practice involves these steps:
1. Create a topic branch (git checkout -b feature-name)
2. Apply your changes and commit them, preferrably in small and isolated 
steps, making sure it compiles after each change.
3. Run "git format-patch origin".

This will result in one or more commit-patches, which contains your 
author info, the commit-messages you wrote, the commit-time and all 
other such info and ofcourse the diff in unified git format. You can 
send those patches on using "git send-email" or apply them using "git am 
-k 00*.txt".

Andreas Ericsson         
OP5 AB                   
Tel: +46 8-230225                  Fax: +46 8-230231
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at
Received on Tue Feb 28 02:28:39 2006

This archive was generated by hypermail 2.1.8 : 2006-02-28 02:28:51 EST