ios - 在每次分支切换优化后安装 pod,清理项目和派生数据

标签 ios xcode git workflow branch

我一遍又一遍地遇到这个问题。每次我用不同的 pod repos 切换分支时,我的 XCode 显然会缓存它们并且无法编译。因此,我必须清理我的项目文件夹清理派生数据重新安装 Pod,然后一切正常。但是我每次切换分支时都必须这样做。知道如何优化这里的工作流程吗?在执行此操作的分支开关之后,我可以在终端中使用任何脚本吗?

最佳答案

您可以使用 post-checkout git hook 在分支更改后做一些额外的工作。来自 here

post-checkout

This hook is invoked when a git checkout is run after having updated the worktree. The hook is given three parameters: the ref of the previous HEAD, the ref of the new HEAD (which may or may not have changed), and a flag indicating whether the checkout was a branch checkout (changing branches, flag=1) or a file checkout (retrieving a file from the index, flag=0). This hook cannot affect the outcome of git checkout.

为此,从项目的根文件夹中执行以下操作

cd .git/hooks
mv post-update.sample post-update

现在编辑 post-update 文件以添加清理和 pod 安装命令。

关于ios - 在每次分支切换优化后安装 pod,清理项目和派生数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48764504/

相关文章:

objective-c - 向 NSImageView 添加图像?

ios - 在模态视图 Controller 后面更改 View Controller

git - 使用git checkout 特定的Hadoop版本

ios - Firebase:iOS:Firebase 读取后数组变空

ios - 使用后台线程更新界面的更快方法

ios - Web View 无法加载特定 URL(Web 工具包错误域 102)

ios - 将二进制数据对象迁移到核心数据实体

git - Squash 在 master 上提交但在功能分支上单独提交?

git - 检查 gitignore 将跟踪哪些文件

iphone - 斯坦福iphone开发教程失败。为什么我的代码会崩溃?