添加子模块的最佳方式是忽略内容 [英] Best way to add sub module ignored content

查看:83
本文介绍了添加子模块的最佳方式是忽略内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个版本库(B)作为我的项目的子模块(A)。在该回购(B)中,有一个专用于该项目的本地配置文件的入门目录。



我想从我自己的项目(A)中版本化该目录的内容。由于这些文件是从(B)开始的,所以我想我可以简单地将它们添加到git中,但是我得到了致命的:Pathspec'oh-my-zsh / custom'在子模块'oh-my-zsh'



最好的方法是什么(我宁愿不改变(B)中的)? b $ b

解决方案

我建议使用符号链接到本地​​文件:

  a 
├──b
│└──本地 - > ../b-local
└──b-local

这很好地区分了内容从repo b 的repo a 。此外, b / local ,所以它不应该对当前的工作流程造成很大的干扰。



或者, git subtree 可能是值得一看。它会让你把repo(B)作为一个子目录导入回购(A)。您的repo用户只需克隆一个repo,而不必通过讨厌的 git submodule update --init 步骤。项目(B)的历史可能被压扁或保持原样。

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.

这篇关于添加子模块的最佳方式是忽略内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆