【问题标题】:My gitignore doesn't work我的 gitignore 不起作用
【发布时间】:2017-03-21 18:43:23
【问题描述】:

我试图为我找到解决方案,但我的 .gitignore 文件仍然无法正常工作

我看到了this post,但它对我没有帮助。

这是我的 gitignore 文件:

# Created by https://www.gitignore.io/api/android,macos

### Android ###
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/dictionaries
.idea/libraries

# Keystore files
*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

### Android Patch ###
gen-external-apklibs

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

但是当我进行 rebild 时,我在 SourceTree 中看到了这个:

libraryProjectFolder/Build 文件夹中的所有文件 ()

【问题讨论】:

标签: android git gitignore


【解决方案1】:

我有一种情况,我在 gitignore 上添加了一个文件,但由于某种原因,我不知道它无法识别 gitignore 上的这个文件,并且仍然在我的工作区显示它。为了忽略这个文件,我使用了下面的命令:

git rm --cached myfile

希望以后能对大家有所帮助。

【讨论】:

    【解决方案2】:

    Git 已经在跟踪这些文件,这就是为什么您仍然可以看到它们。

    您应该在进行任何提交之前创建 .gitignore。

    如果您想取消跟踪这些文件,可以参考following post。如果项目是新项目,您可以创建一个新存储库,将文件复制过来,并确保在进行第一次提交之前,您的新存储库中有 .gitignore 文件。

    【讨论】:

      【解决方案3】:

      这对我有用。我不知道是什么原因。我修改了我的 gitignore,但总是出现我过滤的文件。 这就是我做的:

      • 我未跟踪不必要的文件-
      • 包括 gitignore 模式
      • 提交更改。

      实际上我的存储库工作正常。

      【讨论】:

        猜你喜欢
        • 2023-04-04
        • 1970-01-01
        • 1970-01-01
        • 2014-01-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-31
        相关资源
        最近更新 更多