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

`git rev-parse --git-common-dir` doesn't work in a subdirectory of the main work tree

From
Mike Hommey <mh@glandium.org>
Date
Feb 12, 2016, 03:47 UTC
Message-ID
<20160212034723.GA20739@glandium.org>
Hi,

In a worktree, git rev-parse --git-common-dir returns the non worktree-specific git directory. e.g. .git instead of .git/worktrees/name. The problem is that while it returns the right thing from a subdirectory of a worktree, it doesn't from a subdirectory of the "main" work tree. In the latter case it returns ".git" instead of the full path to it.

Mike
Next: Nguyễn Thái Ngọc Duy
Message 1 of 2 in “`git rev-parse --git-common-dir` doesn't work in a subdirectory of the main work tree”
  1. Mike HommeyFeb 12, 2016
  2. rev-parse: take prefix into account in --git-common-dirNguyễn Thái Ngọc Duy, Feb 12, 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.