是否可以将具有.git文件夹的子文件夹添加到repo,而不将Git视为子模块?我已经尝试了不同的方法来忽略.git文件夹,但是迄今为止没有任何方法可行.
我在/.gitignore尝试过:
/vendor/**/.git/
Run Code Online (Sandbox Code Playgroud)
..and in /vendor/.gitignore:
.git/
Run Code Online (Sandbox Code Playgroud)
我想忽略的.git文件夹位于/ vendor/foo/bar /中.
您可以通过首先直接添加一些(任何)内部内容来做到这一点。Git 通过.git在搜索新遇到的目录时遇到条目来检测子模块,但是如果您给它一个实际路径以在该目录中查找,它不会搜索。
所以
git add path/to/some/submodule/file # bypass initial search that detects .git
git add path/to/some/submodule # now git's index has it as ordinary dir
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1378 次 |
| 最近记录: |