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

Making git apply always work relative to current directory

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 5, 2016, 18:11 UTC
Message-ID
<20160305181125.GA48536@vauxhall.crustytoothpaste.net>

I have a piece of software which must run out of a given directory. In development, this is a git repository, and in production it is not. I also have an ignored subdirectory where I would like to use git apply to apply patches (in both environments).

If I run git apply --no-index --verbose <patch>, it succeeds in both cases, but when I'm in the git repository, it *silently does nothing*. I have to provide a --directory argument in order for it to function underneath the repository, but of course that doesn't work when the directory isn't within a repository. --unsafe-paths did not seem to make a difference. I'm using Git 2.7.2.

Is there a way to tell git apply that it should apply relative to the current working directory, no matter what? I'm happy to send a patch to either the documentation or git apply if necessary.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
Next: Junio C Hamano
Message 1 of 3 in “Making git apply always work relative to current directory”
  1. brian m. carlsonMar 5, 2016
  2. Junio C HamanoMar 5, 2016
  3. brian m. carlsonMar 5, 2016

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.