gpt4 book ai didi

swift - gitignore 不忽略 opencv2.framework

转载 作者:太空宇宙 更新时间:2023-11-03 22:47:24 26 4
gpt4 key购买 nike

我试图让 git 忽略我导入到我的项目中的 opencv2.framework。但是,即使我将 opencv2.framework 添加到我的 .gitignore 中,每次我在终端上运行 git status 时,所有 opencv2.framework 文件都显示为新文件。有人可以帮忙吗?谢谢!这是我的 .gitignore 文件的样子:(我在 ##Various Settings 下写了 opencv2.framework)

# 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/
opencv2.framework/

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

## 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
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# 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

最佳答案

以防万一,查看 git status 是否在之后发生变化:

cd /path/to/my/repo
git rm -r --cached opencv2.framework/

如果确实如此(并且您再也看不到 opencv2.framework/ 文件),请提交您的当前状态。

你需要执行git rm -r --cached:

  • 在要删除的文件夹的父存储库中(opencv2.framework/ 的父级)。
    执行添加和提交(并最终推送),以便从 git repo 中记录删除(但不是从磁盘中,感谢 --cached 选项);
  • 为了删除那些被跟踪的文件,因为.gitignore规则只适用于未被跟踪的文件。

关于swift - gitignore 不忽略 opencv2.framework,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44837071/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com