Xcode如何与Git一起使用来更改分支和结帐旧提交?

前端之家收集整理的这篇文章主要介绍了Xcode如何与Git一起使用来更改分支和结帐旧提交?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
由于版本4.4.1的 Xcode没有switch分支或checkout旧版本功能,因此可以在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.

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

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

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相关文章