0

我在配置 .gitignore 文件时遇到了一个问题,我想在其中忽略一些子文件夹。

那是我的 git 状态:

修改:.gitignore 修改:Client/Android/Cafe/out/production/Cafe/Cafe.apk

修改:Client/Android/Cafe/out/production/Cafe/Cafe.unaligned.apk

我想忽略“out”文件夹中的所有内容,“out”文件夹也忽略。(我的目标是我的 .gitignore 文件不在 Cafe 文件夹中,它位于根目录中)

我已经尝试在 .gitignore 中写下一个注释:

**/出去

/Client/Android/Cafe/out

/Client/Android/**/out

/Client/Android/Cafe/out/*

但是没有什么能帮助我,我的错误在哪里?

编辑:

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   Client/Android/Cafe/.idea/misc.xml
#       modified:   Client/Android/Cafe/.idea/vcs.xml
#       modified:   Client/Android/Cafe/.idea/workspace.xml
#       modified:   Client/Android/Cafe/gen/enthusiasts/apps/Cafe/BuildConfig.ja
va
#       modified:   Client/Android/Cafe/gen/enthusiasts/apps/Cafe/Manifest.java
#       modified:   Client/Android/Cafe/gen/enthusiasts/apps/Cafe/R.java
#       modified:   Client/Android/Cafe/out/production/Cafe/Cafe.apk
#       modified:   Client/Android/Cafe/out/production/Cafe/Cafe.unaligned.apk
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore
no changes added to commit (use "git add" and/or "git commit -a")

感谢你们所有人试图帮助我,但这对我没有帮助。可能是,它应该在舞台状态或其他任何阶段?不知何故 .gitignore 仅适用于根文件夹,但不适用于所有子文件夹。

4

1 回答 1

1

如果文件夹中的文件已经版本化,则需要先从 git 中删除它们git rm -r --cached Client/Android/Cafe/out/

否则,此语法是正确的:

.gitignore

Client/Android/Cafe/out
于 2013-09-19T19:58:14.067 回答