xcode 如何在现有的 iOS 项目中启用源代码管理?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17790045/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:37:15  来源:igfitidea点击:

How to enable Source Control in existing iOS project?

iosxcodeversion-control

提问by cyborg86pl

As in the topic - i have a project that doesn't have Source Control enabled, so how (and if) can i enable it now? I use Snapshots but the project became a big one, and now i need some more "pro" tools. I'm still rather an xcode beginner, so please explain it like i was a cow.

与主题一样 - 我有一个没有启用源代码管理的项目,那么我现在如何(以及如果)启用它?我使用 Snapshots,但该项目变得很大,现在我需要更多“专业”工具。我仍然是一个 xcode 初学者,所以请像我是一头牛一样解释它。

回答by heinst

First off you'll have to install the command line tools for github. You can do so from this link http://mac.github.com/, then either during setup it will ask you to install command line tools, or if it doesn't, you can do it from the preferences menu. Once this is completed, you will be able to follow the instructions on this website to convert your project: conversion tutorial. After all that is done, this websiteexplains everything you could possibly want to know about Source Control and all you can do with it.

首先,您必须为 github 安装命令行工具。您可以通过此链接http://mac.github.com/执行此操作,然后在设置期间它会要求您安装命令行工具,或者如果没有,您可以从首选项菜单中执行此操作。完成后,您将能够按照本网站上的说明转换您的项目:转换教程。完成所有这些之后,该网站将解释您可能想了解的有关源代码管理的所有信息以及您可以使用它执行的所有操作。

EDIT

编辑

If you do not want to install github for the command line tools, you can install Homebrew, which is a package manager (macs equivalent to apt-get), then run brew install gitfor the latest version of git.

如果不想为命令行工具安装 github,可以安装Homebrew,它是一个包管理器(macs 相当于 apt-get),然后运行brew install git最新版本的 git。

回答by Rob van der Veer

After doing a git init,go you the projects tab in the Organizer (top right corner in xcode) There remove the reference to your project and restart xcode to update the changes. Removing the project from Organizer will not delete any files, it will only clear the caches.

完成后git init,转到管理器中的项目选项卡(xcode 的右上角),删除对项目的引用并重新启动 xcode 以更新更改。从管理器中删除项目不会删除任何文件,只会清除缓存。

回答by KHansenSF

I am not sure how to do this from within XCode, but if you are on OSX you can easily initialize git from the command line (within Terminal). From the base directory of the project invoke git init.

我不确定如何在 XCode 中执行此操作,但是如果您使用的是 OSX,则可以从命令行(在终端中)轻松初始化 git。从项目的基本目录调用git init.

Once the project is associated with a git repository, XCode should recognize that and you will see the project listed among the repositories in XCode's Organizer (available from the Window -> Organizer menu)

一旦项目与 git 存储库相关联,XCode 应该识别出这一点,您将看到该项目在 XCode 的管理器中的存储库中列出(可从窗口 -> 管理器菜单中获得)

To upload the project into github, look at the directions here: https://help.github.com/articles/create-a-repo

要将项目上传到 github,请查看此处的说明:https: //help.github.com/articles/create-a-repo