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

Re: [PATCH 2/2] docs: demonstrate difference between 'am' and 'apply'

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 23, 2020, 03:57 UTC
Message-ID
<xmqqtuulk30v.fsf@gitster.c.googlers.com>
In-Reply-To
<20201022231311.GE2774782@google.com>
Emily Shaffer <emilyshaffer@google.com> writes:
Show 8 quoted lines
>> As "git apply" is primarily meant to work on "git diff" output, and
>> it does not necessarily work on an arbitrary mbox (think: MIME), I
>> do not think "if you do not want to make commit, use apply" is a
>> good suggestion to begin with.  They serve completely different
>> purposes and take different form of inputs.
>
> Okay. I think I use 'git am' to apply individual mails, which also can
> be applied with 'git apply';
Yes for 'am', sometimes for 'apply' (think: MIME).
> "This command applies patches from email (e.g. the output of 'git
> format-patch', or an mbox), preserving metadata and creating commits.
Yeah, something like that.  
    This command takes a mbox, each message in which is a piece of
    e-mailed patch, which typically is output of `git format-patch`.
    For each message, the patch text is applied to the current
    branch and recorded as a commit, with the authorship information
    and log message taken from the e-mailed message.
> Use <git-apply> to apply patches (e.g. the output of 'git format-patch'
> or 'git diff') to the worktree without creating commits."

Calling 'git format-patch' output 'patches' the same way as 'git diff' output is inviting confusion. The plural 'patches' makes the confusion worse.

    Use `git apply` when you have diff (e.g. `git diff` output) to
    use to modify the working tree files and optionally the index.
Thanks.
Previous: Emily ShafferNext: Emily Shaffer
Message 9 of 14 in “some small clarifying docfixes”
  1. 0/2 some small clarifying docfixesEmily Shaffer, Oct 16, 2020
  2. 2/2 docs: demonstrate difference between 'am' and 'apply'Emily Shaffer, Oct 16, 2020
  3. Jeff KingOct 16, 2020
  4. Junio C HamanoOct 16, 2020
  5. Junio C HamanoOct 16, 2020
  6. Junio C HamanoOct 16, 2020
  7. Junio C HamanoOct 16, 2020
  8. Emily ShafferOct 22, 2020
  9. Junio C HamanoOct 23, 2020
  10. 1/2 MyFirstContribution: clarify asciidoc dependencyEmily Shaffer, Oct 16, 2020
  11. Junio C HamanoOct 16, 2020
  12. Taylor BlauOct 16, 2020
  13. Junio C HamanoOct 16, 2020
  14. Emily ShafferOct 22, 2020

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.