xcode - Xcode 如何与 Git 一起使用来更改分支和 check out 旧提交?

标签 xcode git

由于 Xcode 4.4.1 版本没有切换分支或检查旧版本功能,是否可以在 bash 中执行此操作

git checkout in-app-purchase-to-be-added

git checkout HEAD^2

因为所有的源码(.m.h),.xib,以及工程文件,图片资源都会在一眨眼,它不会在 Xcode 中引起奇怪的行为吗?现在我总是退出 Xcode,切换分支,然后重新启动 Xcode,但也许有更快的方法。

最佳答案

XCode 应该有一种方法来切换分支,如“Using branches and git with Xcode 4.1”中所述

First off, bring up the organizer’s repositories view and find your project on the left hand side.
Click on the yellowish folder labeled Branches inside of it and then at the bottom of the window click on the Add Branch graphic.
Give the branch a name in the dialog that appears, and be sure to select the checkbox at the bottom to Automatically switch to this branch.

Automatically switch

go back into the organizer’s repository view and click on your blue folder again.
At the bottom of the window you can select Switch Branch
to go back to your master branch (or whichever you want to merge these changes into).

另请参阅“Git Branch Management With Xcode

switch branch

对于更复杂的分支切换/创建,是的,您可能必须通过命令行来完成:

One thing you need to be aware of if you are performing git version control from the command line with the project open in Xcode is that it does not always immediately spot when you have changed something.
I find with the Organizer that you need to switch between some different views before it spots that the current branch has changed.

因此可能并不总是需要关闭/重新打开 XCode,具体取决于项目的性质。

关于xcode - Xcode 如何与 Git 一起使用来更改分支和 check out 旧提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12333546/

相关文章:

ios - 在 Xcode 项目中查找目录

iphone - 无法在 ios 上打开 sqlite 数据库

git - 无法使用第二个个人 github 帐户进行 Git 克隆

git - `git reset HEAD file` 是否也 checkout 文件?

XCode 在模拟器选择中使用 GUID 而不是 iOS 版本号

ios - 如何在 Xcode 中列出一个目标的所有文件

ios - 使用带有 swift 的格式化文本字段创建具有安全文本输入的 PIN 码

javascript - Node.js 生成参数导致 git update-index 失败

git - 对主要分支进行重新设置

git - 如何为 GitHub 上的问题添加标签