小编Rol*_*ser的帖子

如何让git忽略vendor/下的.git文件夹?

我正在使用 Composer,为了进行开发,我想将 .git 文件夹保留在供应商目录中,这样我就可以跟踪差异等。所以我的项目结构是:

projectroot/
  .gitignore
  file1
  file2
  vendor/
    dir1/
      module1/
        .git/
        module1file1
        module1file2
        ...
    dir2/
      module2/
        .git/
        module2file1
        ...
Run Code Online (Sandbox Code Playgroud)

我想提交到 git,这些文件:

file1
file2
vendor/dir1/module1/module1file1        
vendor/dir1/module1/module1file2    
vendor/dir2/module2/module2file1        
...
Run Code Online (Sandbox Code Playgroud)

我的projectroot/.gitignore 文件应该是什么?从我尝试过的作曲家文档中

vendor/*.git
Run Code Online (Sandbox Code Playgroud)

vendor/*/.git
Run Code Online (Sandbox Code Playgroud)

但在这两种情况下, git 1.8.3 仍然想提交vendor/dir1/module1vendor/dir2/module2作为子模块,我想提交下面的文件。

在这种情况下 .gitignore 语法应该是什么?

git gitignore composer-php

5
推荐指数
1
解决办法
4006
查看次数

标签 统计

composer-php ×1

git ×1

gitignore ×1