美文网首页
Object-C忽略文件-2020-12-29

Object-C忽略文件-2020-12-29

作者: 勇往直前888 | 来源:发表于2020-12-29 15:17 被阅读0次

忽略文件

git是一种代码管理的方式;但是,并不是所有的代码都需要进行管理更新的,所以就会有一个配置文件,指明那些文件不需要git管控。
git里,这个定义不管控的文件是一个隐藏文件.gitignore

image.png

Object-C

各种语言的忽略文件内容不相同,在GitHub上有一个专门的项目,搜集了各种语言的忽略内容,非常好用Object-C忽略文件。一般情况下,直接用就可以了。比如Object-C的内容如下:

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

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

# 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/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# 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/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

Pod文件夹要忽略吗?

  1. 如果忽略,那么只保存了podfile,那么每个下载代码的人都需要执行pod install命令。

  2. 如果不忽略,那么Pod文件夹下的第三方库直接以代码的形式放在自己的git代码库中。普通开发者通过git下载之后,不需要进行任何pod相关操作,就可以直接编译运行工程。

  • 两种选择都有各自的道理,也都有人在用。在这里,我选择第2种。pod相关操作只需要有一个人负责就行,其他人不需要知道。

  • 默认提供的.gitignore文件也是选择第2种:

# 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/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

默认是注释掉的,也就是Pod文件夹不忽略,第三方库代码要管控;选第1种的话只要把相关注释取消就行了。

.xcodeproj文件

这个文件很特殊,在mac上看好像是一个文件,但是在其他操作系统上看,比如Windows平台上看,它其实是一个文件夹。
Xcode 工程文件“.xcodeproj”文件夹解析

  • project.pbxproj文件;这个很重要,冲突有很多来自这里,要谨慎对待

  • xcuserdata文件夹;这个每次打开都会修改,一定要忽略,不然会被烦死的;

  • xcshareddata 文件夹;这个基本上不会用到,不过不能忽略;

  • project.xcworkspace 文件夹 ;这个文件很重要,用了Pod,要双击这个才能打开工程;

默认提供的.gitignore文件也是这么设置的,只忽略xcuserdata文件夹:

## User settings
xcuserdata/

相关文章

  • Object-C忽略文件-2020-12-29

    忽略文件 git是一种代码管理的方式;但是,并不是所有的代码都需要进行管理更新的,所以就会有一个配置文件,指明那些...

  • .mm文件

    .m文件是纯Object-C 文件.mm是Object-C和C++混合文件 .m只能调用纯Object-C的类,不...

  • IOS的.m和.mm文件总结

    1. .m文件是纯Object-C 文件 .mm是Object-C和C++混合文件 2. .m只能调用纯Objec...

  • iOS开发:获取设备IP地址

    在c++或者Object-C文件下,添加头文件: 并添加以下代码:

  • Git Os创建项目

    先忽略再add,忽略文件参考原有的app忽略文件

  • 2020-12-29

    2020-12-29

  • Android Studio SVN使用时忽略的文件

    需要忽略的文件 其实忽略通常遵循以下原则 系统自动生成文件忽略 本地配置文件忽略 第三方依赖忽略在Android ...

  • Android Studio 设置忽略文件,上传项目到码云

    为了使设置的忽略文件有效,要先设置忽略文件,再关联项目 设置忽略文件 设置忽略文件的两种方式: 在项目的.idea...

  • @objc 和 dynamic

    Swift 和 Object-C 混编 添加桥接文件, {product-module-name}-Bridgin...

  • 忽略文件

    一般我们总会有些文件无需纳入 Git 的管理,也不希望它们总出现在未跟踪文件列表。 通常都是些自动生成的文件,比如...

网友评论

      本文标题:Object-C忽略文件-2020-12-29

      本文链接:https://www.haomeiwen.com/subject/nsgfoktx.html