git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Emily Shaffer <emilyshaffer@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] docs: demonstrate difference between 'am' and 'apply'
Date: Thu, 22 Oct 2020 20:57:36 -0700	[thread overview]
Message-ID: <xmqqtuulk30v.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20201022231311.GE2774782@google.com> (Emily Shaffer's message of "Thu, 22 Oct 2020 16:13:11 -0700")

Emily Shaffer <emilyshaffer@google.com> writes:

>> 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.

      reply	other threads:[~2020-10-23  3:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 20:52 [PATCH 0/2] some small clarifying docfixes Emily Shaffer
2020-10-16 20:52 ` [PATCH 1/2] MyFirstContribution: clarify asciidoc dependency Emily Shaffer
2020-10-16 21:21   ` Junio C Hamano
2020-10-16 21:52     ` Taylor Blau
2020-10-16 22:48       ` Junio C Hamano
2020-10-22 23:14         ` Emily Shaffer
2020-10-16 20:52 ` [PATCH 2/2] docs: demonstrate difference between 'am' and 'apply' Emily Shaffer
2020-10-16 21:13   ` Jeff King
2020-10-16 22:04     ` Junio C Hamano
2020-10-16 21:53   ` Junio C Hamano
2020-10-16 21:59     ` Junio C Hamano
2020-10-16 22:12     ` Junio C Hamano
2020-10-22 23:13     ` Emily Shaffer
2020-10-23  3:57       ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqtuulk30v.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).