简体   繁体   English

将git存储库添加到Xcode 4

[英]Adding a git repository to Xcode 4

When I add an existing repository to Xcode (using "Add Working Copy") I get the error message "Unable to load revisions". 当我将现有存储库添加到Xcode(使用“添加工作副本”)时,出现错误消息“无法加载修订”。

Any suggestions on what to do? 有关该怎么办的任何建议?

From your question, I'm assuming you do not have a remote repository and only a local one? 根据您的问题,我假设您没有远程存储库,而只有本地存储库?

If so, I had this problem many times as well, and no matter what I did, Xcode wouldn't recognize my git revisions. 如果是这样,我也会遇到很多问题,无论我做什么,Xcode都不会识别我的git版本。 So, I simply restarted Xcode in frustration and it worked. 因此,我无奈地重新启动了Xcode,它起作用了。 Hopefully its as simple as that for you. 希望它和您一样简单。

You know what? 你知道吗? I wouldn't. 我不会。

Xcode's "version control" interface is built to be agnostic about which back-end it's using, SVN or git. Xcode的“版本控制”界面旨在与使用哪个后端,SVN或git无关。 It's built for the lowest common denominator of shared features. 它是为共享功能的最低公分母而构建的。 As a result, most of the power of git is explicitly not supported within Xcode itself. 结果,Xcode本身明确不支持git的大多数功能。

I quit using Xcode's version control completely when I realized this. 当我意识到这一点时,我完全放弃了使用Xcode的版本控制。 I like Tower 2 for a gorgeous and Mac-ish git GUI, and the command line for most of my heavy lifting. 我喜欢Tower 2以获得出色的Mac-ish git GUI,并喜欢使用命令行进行大多数繁重的工作。

I'm assuming you have your repository added in Organizer. 我假设您在管理器中添加了存储库。 You clone the revision to a local folder where your changes are saved. 您将修订克隆到保存更改的本地文件夹。 You then work inside the cloned folder, committing and pushing changes up to your repository. 然后,您在克隆的文件夹中工作,将更改提交并推送到存储库中。

While I won't go so far to say don't use git in XCode, the implementation does leave something to be desired. 尽管我不会说不在XCode中使用git,但该实现确实有一些不足之处。 So unless you are going to use git entirely in the command line (which learning some commands is almost going to be required to pull off after the fact git implementation), it is going to take some work. 因此,除非您打算在命令行中完全使用git(实际上在实现git之后几乎需要学习一些命令),否则它将需要一些工作。

Here is a link how to set up git in XCode by github. 这是一个如何通过github在XCode中设置git的链接。

XCode 4 released with git integration 带有git集成的XCode 4发布

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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