ios - 如何在 podfile 中获取 git 分支?
问题描述
所以我在一个使用 cocoapods 的 iOS 项目中工作。我有一些通过 cocoapods 添加的自定义库。例如:
pod 'MyLibrary', :git => 'git@git.mydomain.com:pods/mylibrary-pod.git', :tag => '1.1'
我想根据我当前的 git 分支更改 MyLibrary 的版本。像这样的东西:
if DEVELOP_BRANCH
pod 'MyLibrary', :git => 'git@git. mydomain.com:pods/mylibrary-develop-pod.git', :tag => '1.1.7'
else if MASTER_BRANCH
pod 'MyLibrary', :git => 'git@git. mydomain.com:pods/mylibrary-pod.git', :tag => '1.1'
但我不知道是否有任何方法可以从我的本地存储库中检查当前的 git 分支。有人知道这是否可能以及一种方法吗?
解决方案
在这里,您可以在库 repo 的根目录中查看来自 podspec 的指南。 喜欢用 Almofire
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'
希望这会有所帮助,谢谢
推荐阅读
- python - Django:导入模型有效,之后立即导入它的实例失败
- dom - Vue.js - 路由更改后未从父组件中删除 DOM 元素
- apache - 如何修复 Apache 服务器子 pid 637 退出信号分段错误(11),/etc/apache2 中可能的核心转储问题
- couchbase - 聚合 couchbase 文档数据
- c# - 让 C# 控制台应用程序包装完整的单词而不是拆分它们
- swift - 在另一个 ViewController 中打开全尺寸图像,可以捏合缩放,例如 Whatsapp
- android - 谷歌材料库更新后,底页视图无法完全展开?
- matrix - 如何在 Fortran 90 中获得 nxn 矩阵的共轭?
- java - Java Regex:“10{1,1 %d},10{2,1 %d}”等模式的正则表达式是什么?
- python - linux Ubuntu下创建虚拟环境时出错