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

git submodules and custom work tree / git dir

From
MGMichael Gorbach <michael@mgorbach.name>
Date
Dec 9, 2011, 16:48 UTC
Message-ID
<loom.20111209T173452-58@post.gmane.org>

I am working on a setup for managing my personal config files (shell settings and vim settings and such) using git.

I have a git repository which ignores all files by default, so they don't cloud status. I have the following aliases: alias config='git --git-dir=$HOME/.config.git/ --work-tree=$HOME' alias config-add='git --git-dir=$HOME/.config.git --work-tree=$HOME add -f'

This works pretty well. It means that the config repo is separate from other git repos, and I won't accidentally touch it by just typing "git." What I'm trying to do now is to track vim (bundle) modules inside this git repo, which requires the use of git submodules. It appears that submodules don't work with this weird configuration.

By calling git as in the "config" alias above, except removing the --work-tree argument, I was able to add submodules successfully with git submodule add. The submodule info is written into .gitmodules and .config.git/config as expected. However, the submodule doesn't seem to "stick." It displays when I type "config status" as "untracked content" no matter what I do, even though there is no untracked content and no change in the submodule.

Is there a way to make submodules work reasonably with git when using the --work-tree and --git-dir arguments?

Message 1 of 1 in “git submodules and custom work tree / git dir”
  1. Michael GorbachDec 9, 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.