Best way to add sub module ignored content

丶灬走出姿态 提交于 2019-12-08 04:16:08

问题


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))?


回答1:


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.



来源:https://stackoverflow.com/questions/31315655/best-way-to-add-sub-module-ignored-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!