git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Quick question: how to generate a patch?

From
Andreas Ericsson <ae@op5.se>
Date
Feb 27, 2006, 15:28 UTC
Message-ID
<44031A84.1080704@op5.se>
In-Reply-To
<6d6a94c50602270657m453cc581p6ec290c20879de25@mail.gmail.com>
Aubrey wrote:
Show 14 quoted lines
> 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                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: AubreyNext: Linus Torvalds
Message 2 of 13 in “Quick question: how to generate a patch?”
  1. AubreyFeb 27, 2006
  2. Andreas EricssonFeb 27, 2006
  3. Linus TorvaldsFeb 27, 2006
  4. AubreyFeb 27, 2006
  5. Linus TorvaldsFeb 27, 2006
  6. AubreyFeb 27, 2006
  7. Andreas EricssonFeb 27, 2006
  8. AubreyFeb 27, 2006
  9. Linus TorvaldsFeb 27, 2006
  10. AubreyFeb 28, 2006
  11. Linus TorvaldsFeb 28, 2006
  12. AubreyFeb 28, 2006
  13. Linus TorvaldsFeb 27, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.