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

Re: [PATCH 2/4] apply: apply works outside a repository

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 22, 2009, 17:28 UTC
Message-ID
<7v3a46ii3o.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B0964A1.2040302@gmail.com>
Björn Gustavsson <bgustavsson@gmail.com> writes:
> The documentation for 'git apply' talks about applying a
> patch/diff to the index and to the working tree, which seems
> to imply that it will not work outside a git repository.

Thanks. I think the headline should also be reworded. It currently reads:

    Apply a patch on a git index file and/or a working tree

but historically and still in real life practices, when you use apply (as opposed to am), you apply primarily to the files and optionally to the index, so this should read something like:

    Apply a patch to files and/or to the index

We could say "to files in the work tree", but that would give a wrong impression that the files we talk about must be in a directory that is part of the work tree of some repository, so it probably is better without it.

The same comment applies to the beginning of the DESCRIPTION section. I actually think your added text should reword the current two-liner there, instead of being added at the bottom. Here is my attempt.

    Reads supplied diff output (iow "a patch"), and applies it to files.
    With --index (--cache) options, the patch is also (only) applied to
    the index respectively.  Without these options, the command applies
    the patch only to files, and does not require them to be in a git
    repository.
Previous: Björn Gustavsson
Message 2 of 2 in “apply: apply works outside a repository”
  1. 2/4 apply: apply works outside a repositoryBjörn Gustavsson, Nov 22, 2009
  2. Junio C HamanoNov 22, 2009

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.