首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >源代码12源代码管理-> .gitignore文件

源代码12源代码管理-> .gitignore文件
EN

Stack Overflow用户
提问于 2020-12-21 19:46:36
回答 1查看 3.3K关注 0票数 0

我试图忽略我的项目中的所有图片。

我在项目文件所在的根目录中有一个.gitignore文件。我用"touch .gitignore“创建了这个文件,然后应用了https://www.gitignore.io生成的输入,其中包含了关键字from和xcode。之后,我在下面的“其他”注释下面应用了下面的模式

*.png *.imageasset

忽略所有图像。

对于特定的文件夹和文件,xcode中的源代码控件不再在提交时向我显示这个文件,但是图像将始终显示。我还试图通过Preferences ->源代码管理-> Git Git ->忽略文件阻止图像,但它没有工作。

,顺便说一下,图像文件不在我的存储库中,我从未提交过它们。

.gitignore文件:

代码语言:javascript
复制
# Created by https://www.gitignore.io/api/swift,xcode

### Swift ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
*.png
*.imageasset

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
.build/

# CocoaPods - Refactored to standalone file

# Carthage - Refactored to standalone file

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated

## Various settings

## Other

### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno

# End of https://www.gitignore.io/api/swift,xcode
EN

回答 1

Stack Overflow用户

发布于 2020-12-21 22:20:43

如果git在添加.gitignore文件之前跟踪图像文件,它将在添加.gitignore文件后继续跟踪它们。您必须从git存储库中删除图像文件,提交更改,并将图像文件添加回项目以忽略图像文件。

在尝试从git存储库中删除图像文件之前,我建议备份项目并创建一个新分支。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65399034

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档