我在配置.gitignore文件时面临一个问题,我想忽略一些子文件夹。
这是我的git状态:
修改:.gitignore 修改:客户端/ Android / Cafe / out / production / Cafe / Cafe.apk
已修改:客户端/ Android / Cafe / out / production / Cafe / Cafe.unaligned.apk
我想忽略" out"内部的所有内容。文件夹," out"文件夹也忽略了。(我把注意力集中在我的.gitignore文件不在Cafe文件夹中,它在根目录中)
我已经尝试写下.gitignore下一个注释:
** /出
/客户端/ Android设备/咖啡/输出
/客户端/ Android的/ ** /出
/客户端/ Android设备/咖啡/缩小/ *
但没有什么可以帮助我,我的错误在哪里?
$ 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")
感谢你们所有人试图帮助我,但它对我没有帮助。可能是,它应该处于舞台状态或其他任何阶段? Somewhy .gitignore仅适用于根文件夹,但不适用于所有子文件夹。
答案 0 :(得分:1)
如果文件夹中的文件已经过版本化,则需要先使用git rm -r --cached Client/Android/Cafe/out/
否则,这种语法是正确的:
<强>的.gitignore 强>
Client/Android/Cafe/out