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

Re: [idea] separate .git dir and the working tree

From
Rredstun <redstun@gmail.com>
Date
Feb 5, 2011, 14:24 UTC
Message-ID
<AANLkTinYMuXSvKjgtpSCbJPuo=PHDGR_OgOkwtV4Azmz@mail.gmail.com>
In-Reply-To
<20110205132708.GA18391@elie>
Making .git a symbol link is nice.

Regarding the GIT_DIR variable, looks like it needs to be paired with the GIT_WORK_TREE variable, does this mean that I can only have one local git repository?

what I wanted is, I may have multiple git working tree in my $HOME, like: $HOME/proj1 $HOME/proj2,

I then wanted their .git directories respectively located at /safe/disk/.git_proj1 /safe/disk/.git_proj2

How can I get this? I tried to read the doc but didn't have much luck.
Thanks
On Sat, Feb 5, 2011 at 9:27 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 21 quoted lines
> (restoring cc list; please do not cull cc's)
>
> Mike Gant wrote:
>> On Sat, Feb 05, 2011 at 10:53:58AM +0800, redstun wrote:
>
>>> I think separating the .git directory from its working tree could
>>> increase the safety of the data to one more level higher.
> [...]
>> GIT_DIR and GIT_WORK_TREE might be what you are looking for. Explanation
>> of usage in 'man git'
>
> The .git directory is allowed to be a symlink.  Or a file like so
>
>        gitdir: /path/to/git/repo
>
> for symlink-challenged operating systems.  See gitrepository-layout(7)
> for details.
>
> Cheers,
> Jonathan
>
Previous: Jonathan NiederNext: Jonathan Nieder
Message 4 of 12 in “[idea] separate .git dir and the working tree”
  1. redstunFeb 5, 2011
  2. Mike GantFeb 5, 2011
  3. Jonathan NiederFeb 5, 2011
  4. redstunFeb 5, 2011
  5. Jonathan NiederFeb 5, 2011
  6. Mike GantFeb 6, 2011
  7. Mike GantFeb 6, 2011
  8. Jared HanceFeb 6, 2011
  9. Konstantin KhomoutovFeb 6, 2011
  10. [idea] Re: separate .git dir and the working treeNicolas Sebrecht, Feb 6, 2011
  11. Mike GantFeb 7, 2011
  12. Michael WittenMay 23, 2011

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.