加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 17:53:55 所属栏目:百科 来源:网络整理
导读:由于版本4.4.1的 Xcode没有switch分支或checkout旧版本功能,因此可以在bash中执行此操作 git checkout in-app-purchase-to-be-added 要么 git checkout HEAD^2 因为所有源代码(.m,.h),.xib和项目文件,图像资源都会在眨眼之间发生变化,所以它不会在Xcode中引
由于版本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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读