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

Re: Need to set GIT_WORK_TREE when setting GIT_DIR !?

From
FHFrédéric Heitzmann <frederic.heitzmann@gmail.com>
Date
Mar 10, 2012, 13:23 UTC
Message-ID
<4F5B55E8.4080000@gmail.com>
In-Reply-To
<7v4ntx4bol.fsf@alter.siamese.dyndns.org>
Le 10/03/2012 00:06, Junio C Hamano a écrit :
Show 6 quoted lines
> Yes, to the question on the Subject line.  But you can also say
>
>      [core] worktree = /path/to/the/work/tree
>
> in $GIT_DIR/config.  Make sure your $GIT_DIR/config does *NOT* say
> that the repository is a bare repository.

Thanks for clarification. However man git-config says :

"If --git-dir or GIT_DIR is specified but none of --work-tree, GIT_WORK_TREE and core.worktree is specified, the current working directory is regarded as the top level of your working tree."

Some more context on my precise problem : I have a project, with source files managed with git. I also use some Makefiles that I would like to manage with git _in a separate repository_

$ GIT_DIR=<project_path>/.git git add some_file.c ... $ GIT_DIR=<project_path>/.git_mk git add Makefile ...

Setting worktree in each GIT_DIR/config will fix that but I can't figure out why current git implementation actually needs this.

-- Fred

Previous: Junio C HamanoNext: Nguyen Thai Ngoc Duy
Message 3 of 7 in “Need to set GIT_WORK_TREE when setting GIT_DIR !?”
  1. Frédéric HeitzmannMar 9, 2012
  2. Junio C HamanoMar 9, 2012
  3. Frédéric HeitzmannMar 10, 2012
  4. Nguyen Thai Ngoc DuyMar 10, 2012
  5. Junio C HamanoMar 10, 2012
  6. Jonathan NiederMar 10, 2012
  7. Frédéric HeitzmannMar 11, 2012

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.