简体   繁体   中英

How to get git branch inside the podfile?

So I'm working in an iOS project using cocoapods. I have some custom libraries that are added via cocoapods. For example:

pod 'MyLibrary', :git => 'git@git.mydomain.com:pods/mylibrary-pod.git', :tag => '1.1'

I'd like to change the MyLibrary's version depending on the current git branch I am. Something like that:

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' 

But I don't know if there is any way to check the current git branch from my local repository. Does someone knows if it's possible and a way to do it?

Here you can see Guideline for From a podspec in the root of a library repo. like to use Almofire

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'

Hope this will help, Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM