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

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

From
Björn Gustavsson <bgustavsson@gmail.com>
Date
Nov 22, 2009, 19:43 UTC
Message-ID
<4B09946E.6050409@gmail.com>

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.

Actually 'git patch' works outside a repository (which can be useful especially for applying binary or rename patches that the standard "patch" utility cannot handle), so the documentation should mention it.

Thanks to Junio for suggesting better wording.
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
---
 Documentation/git-apply.txt |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index 0156ca9..0c55ca9 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt
@@ -3,7 +3,7 @@ git-apply(1)
 
 NAME
 ----
-git-apply - Apply a patch on a git index file and/or a working tree
+git-apply - Apply a patch to files and/or to the index
 
 
 SYNOPSIS
@@ -20,8 +20,11 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Reads supplied 'diff' output and applies it on a git index file
-and a work tree.
+Reads the supplied diff output (i.e. "a patch") and applies it to files.
+With the `--index` option the patch is also applied to the index, and
+with the `--cache` option the patch is only applied to the index.
+Without these options, the command applies the patch only to files,
+and does not require them to be in a git repository.
 
 OPTIONS
 -------
-- 
1.6.5.3.298.g39add
Message 1 of 1 in “apply: apply works outside a repository”
  1. 2/4 apply: apply works outside a repositoryBjörn Gustavsson, Nov 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.