I'm using a repository (B) as a submodule of my project (A). In that repo (B), there is an ingored directory, dedicated to local config files for that project.
I'd like to version the content of that directory from my own project (A). Since those files are gitignored from (B), I thought I could simply git-add them but I get fatal: Pathspec 'oh-my-zsh/custom' is in submodule 'oh-my-zsh'
.
What is the best way to do that (I'd rather not change anyting in (B))?
I'd suggest using a symlink to the local files:
a
├── b
│ └── local -> ../b-local
└── b-local
This nicely separates content of repo a from that of repo b. Furthermore, as b/local
is gitignored, it should not be very intrusive to your current workflow.
Alternatively, git subtree might be worth a look. It would let you import repo (B) as a subdirectory into repo (A). Users of your repo would just have to clone a single repo and wouldn't have to go through the pesky git submodule update --init step. The history of project (B) could be either squashed or kept completely as is.