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

Re: GIT_DIR=. for hooks?

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 6, 2010, 17:13 UTC
Message-ID
<7v7hrvyx4s.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B44965F.8040803@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> I can unset GIT_DIR or set WORK_TREE, of course,

That is not just an acceptable but _the_ right way to write hooks that touch the files in the work tree. In earlier versions of git, a git-dir in $PWD was not found without GIT_DIR=. and hooks are supposed to work across versions of git, so this behaviour got stuck.

Previous: Michael J Gruber
Message 2 of 2 in “GIT_DIR=. for hooks?”
  1. Michael J GruberJan 6, 2010
  2. Junio C HamanoJan 6, 2010

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.