.gitignore与子目录有关

时间:2015-12-03 21:41:45

标签: git unity3d

我的Unity项目的gitignore文件出现问题。我想排除我的资产文件夹,但“Include Me”条目下的子目录除外。

Assets / Scripts和Assets / Scenes下的所有文件都被添加到我的存储库中,但不会添加到Assets / Cards ...子目录中。我真的无法弄清楚为什么一个包含/排除模式正在工作但其他模式不起作用。

如何使此文件能够包含其他子目录?

# =============== #
# Unity generated #
# =============== #
Temp/
Library/
Builds/
Assets/*

# ============ #
# Include Me   #
# ============ #

!Assets/Scripts
!Assets/Scenes/
!Assets/Cards/Miniatures/Resources/*
!Assets/Cards/Miniatures/Resources/
!Assets/Cards/Spells/Resources/
!Assets/Cards/Spells/Resources/*

2 个答案:

答案 0 :(得分:1)

此问题在此之前已经多次得到回答......例如。

<强> .gitignore exclude folder but include specific subfolder

答案 1 :(得分:0)

Caio说的应该是有效的。如果我没错?

# =============== #
# Unity generated #
# =============== #
Temp/
Library/
Builds/
Assets/*
Assets/Cards/*
Assets/Cards/Miniatures/*
Assets/Cards/Spells/*

# ============ #
# Include Me   #
# ============ #

!Assets/Scripts
!Assets/Scenes/
!Assets/Cards/
!Assets/Cards/Miniatures
!Assets/Cards/Miniatures/Resources/
!Assets/Cards/Spells/
!Assets/Cards/Spells/Resources/