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

Re: the ".git" folder

From
Duy Nguyen <pclouds@gmail.com>
Date
Apr 20, 2014, 09:49 UTC
Message-ID
<CACsJy8CXADh_wrHeqf47FuBUiF8pq_xboUPnts6mP8iVj0F-Pg@mail.gmail.com>
In-Reply-To
<7F780F951A13B047BB0CE5F6EA9069C121871366@hou150w8xmbx06.hou150.chevrontexaco.net>
On Sun, Apr 20, 2014 at 4:13 PM, Miller, Hugh <HughMiller@chevron.com> wrote:
> Dear Community,
>
> Is there any way to use .git (e.g., a different set of "client" commands) that allows the .git folder to be placed in a location away from the actual files being versioned ? For example, can one set environment variables that let the software know where the .git folder is ?
Try

git --git-dir=<new .git location> --work-tree=<top work tree location> <some command>

The reason of two arguments instead of one is because .git is also used to mark top work tree location, which is now lost after you move .git elsewhere. You could also set environment variables GIT_DIR and GIT_WORK_TREE, which have the same effect. "man git" for details.

-- 
Duy
Previous: Miller, HughNext: Kevin
Message 2 of 4 in “the ".git" folder”
  1. Miller, HughApr 20, 2014
  2. Duy NguyenApr 20, 2014
  3. KevinApr 20, 2014
  4. Junio C HamanoApr 20, 2014

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.