Xcode 8:如何将GIT存储库添加到现有项目 [英] Xcode 8: how to add a GIT repository to an existing project

查看:138
本文介绍了Xcode 8:如何将GIT存储库添加到现有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我创建这个Xcode(Swift)项目时,我忘了检查Create Git repository。我花了好几个小时才让项目的第一部分工作,然后意识到我不能做GIT提交。有没有办法纠正这种疏忽? IOW有没有办法将现有的Xcode项目改为包含GIT存储库?



通常我会在开始时进行一次GIT提交,但我显然忘记了这么做。



我不会花时间学习GIT命令行命令。如果这就是我所要做的,我将改为创建一个包含存储库的新项目,并从现有项目中将所有内容复制到其中。我已经完成了,但它不像听起来那么简单。

解决方案

检查您是否在您的源代码管理中启用了现有的XCode项目。

Xcode>偏好...>源代码管理:检查启用源代码管理框。

这会让您访问Git菜单命令。



有关完整教程(仅限XCode,而不是git命令行),请参阅



OP RobertL 增加在评论中


这个答案错过了一件事,即它只将一个文件放入存储库,而不是所有的项目文件。 >
如果您对每个文件进行更改e项目并再次提交,他们都进入存储库。



When I created this Xcode (Swift) project I forgot to check "Create Git repository". I spent many hours getting the first part of the project working and then realized I can't do a GIT commit. Is there some way to correct that oversight? IOW is there a way to change an existing Xcode project to include a GIT repository?

Usually I make a GIT commit right at the beginning but I obviously forgot to do that.

I'm not going to spend the time to learn GIT command line commands. If that's what it would take I'll instead make a new project that includes a repository and copy everything into it from the existing project. I've done that before but it's not quite as simple as it sounds.

解决方案

Check if you have enabled Source Control in your existing XCode project.

Xcode > Preferences... > Source Control: check the Enable Source Control box.
That will give you access to Git menu commands.

For a full tutorial (XCode only, not git command line), see "Using Git with an existing XCode project" (answer starting with "Xcode 7 (and 8)")

The OP RobertL adds in the comments:

that answer misses one thing, namely that it puts only one file into the repository, not all of the project files.
If you make a change in every file in the project and commit again they all get into the repository.

这篇关于Xcode 8:如何将GIT存储库添加到现有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆