Git忽略.git文件夹 [英] Git ignore .git folder

查看:207
本文介绍了Git忽略.git文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用composer进行包管理的php项目。其中一个软件包是另一个属于同一个仓库的项目。我需要提交我的整个供应商文件夹,但是我想忽略子项目中的.git文件夹,这样它就不会像子模块那样处理。



<到目前为止,我没有成功。我已经尝试过的东西:

vendor / .git

vendor / ** /。git /



google搜索

堆栈溢出搜索




以下是GitLab中的子项目文件夹的样子。而不是文件,它只是某种引用。



解决方案

对于我来说,这看起来像是一个设计错误:

如果从同一个存储库加载第二个项目作为依赖项,这个项目应该被移到不同的仓库。



里面供应商目录将另一个.gitignore文件与

 #忽略此处的Git 
.git

#但不是这些文件...
!.gitignore


I have a php project that uses composer for package management. One of the packages is another project belonging to the same repo. I have a need to commit my entire vendor folder, but I want to ignore the .git folder in the sub-project so that it doesn't get treated like a submodule.

So far I have had no success. Things I've already tried:

vendor/.git

vendor/**/.git/

google search

stack overflow search


Here's what the sub-project folder looks like in GitLab. Instead of the files, it's just some kind of reference.

解决方案

For me this looks like a design error:

If you load a second project from the same repository as dependency, this project should be moved to a different repository.

And inside the vendor Directory place another .gitignore file with

# Ignore Git here
.git

# But not these files...
!.gitignore

这篇关于Git忽略.git文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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