git 可以与 Xcode 集成吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/456403/
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
Can git be integrated with Xcode?
提问by Gordon Wilson
Is there any way to use a git repository with the built in SCM functions of Xcode?
有什么方法可以使用带有 Xcode 内置 SCM 功能的 git 存储库?
采纳答案by TodK
Xcode 4 supports git natively (Developer Tools State of the Union Address at WWDC 2010)
Xcode 4 原生支持 git(开发者工具 State of the Union Address at WWDC 2010)
Learn more here: What's new in Xcode 4
The documentationfrom Apple is lengthy, but a good read.
在此处了解更多信息:Xcode 4 中的新功能Apple
的文档很长,但值得一读。
回答by Abie
NOTE:despite all the up-votes, this answer is out of date as of June 2010
注意:尽管获得了所有赞成票,但截至 2010 年 6 月,此答案已过时
There's no git support withinXcode, but that's no reason not to use git for your Xcode projects. I've had good results managing my Xcode projects using the standard git command line or GitX.
有没有Git支持内Xcode的,但是这是没有理由不使用git为您的Xcode项目。我在使用标准 git 命令行或GitX管理我的 Xcode 项目方面取得了很好的效果。
Shane Vitarana has a nice set of .gitignore
settingsto use as a starting point.
Shane Vitarana 有一组不错的.gitignore
设置可用作起点。
回答by Mark
A nice way to "Integrate" git with Xcode is to use DTerm. You bring up DTerm in a floating window with a key combination. DTerm knows the full path to the current document in the editor.
将 git 与 Xcode“集成”的一个好方法是使用DTerm。您可以使用组合键在浮动窗口中调出 DTerm。DTerm 知道编辑器中当前文档的完整路径。
For Example to run a diff on the file you are editing you:
例如,在您正在编辑的文件上运行差异:
1) Press Ctrl-Return to bring up the DTerm window. (This key combo is configurable).
1) 按 Ctrl-Return 调出 DTerm 窗口。(此键组合是可配置的)。
2) type 'git diff cmd-shift-V'. That will overwrite the last command when you start typing and insert the name of the current file in the window. Since your working directory is set to the parent directory of the selected file the command is nice and short.
2) 输入'git diff cmd-shift-V'。当您开始键入并在窗口中插入当前文件的名称时,这将覆盖上一个命令。由于您的工作目录设置为所选文件的父目录,因此该命令既好又短。
I have no connection at all with Decimus. I am just a satisfied user who has run thousands of commands through DTerm.
我和Decimus完全没有关系。我只是一个满意的用户,通过 DTerm 运行了数千个命令。
Edit: As of 27 August 2009 DTerm is free. If you bought your copy of DTerm, the upgrade to the next version is free, regardless of when you purchased DTerm. See their blog post
编辑:截至 2009 年 8 月 27 日,DTerm 是免费的。如果您购买了 DTerm 副本,则无论您何时购买 DTerm,都可以免费升级到下一个版本。看他们的博文
Edit 2: DTermis now available on the Mac App Store. It will be interesting to see if they kept the promise that they made in their blog post.
编辑 2:DTerm现在可在 Mac App Store 上使用。看看他们是否遵守了他们在博客文章中做出的承诺会很有趣。
回答by Mark
In addition to the .gitignore settings referenced from the post above I have added the generated files to my config file.
除了上面帖子中引用的 .gitignore 设置之外,我还将生成的文件添加到我的配置文件中。
build/
*.pyc
*~.nib/
*.pbxuser
*.perspective
*.perspectivev3
*.xcworkspace/
xcuserdata/
build/
*.pyc
*~.nib/
*.pbxuser
*.perspective
*.perspectivev3
*.xcworkspace/
xcuserdata/
This helps to keep the noise out of my depot.
这有助于将噪音排除在我的仓库之外。
If I need to add generated files I add a Release folder and keep the *.framework and *.app folders to my project directory. I add anything I release to the testing group to the Release folder and tag it.
如果我需要添加生成的文件,我会添加一个 Release 文件夹并将 *.framework 和 *.app 文件夹保留到我的项目目录中。我将我发布到测试组的任何内容添加到发布文件夹并标记它。
回答by Daniel Hill
No, there's not, and to be honest I'm rather grateful, as the SVN support in Xcode seemed really flaky to me. After I moved to Git for my personal projects, I just have a Terminal window open that I can fire off git add
and git commit
as needed.
不,没有,老实说我很感激,因为 Xcode 中的 SVN 支持对我来说真的很脆弱。之后,我搬到混帐我的个人项目,我只是有一个终端窗口打开,我可以断火git add
,并git commit
根据需要。
回答by Chris Hanson
Xcode doesn't have a public plug-in API, so no, there's no way to directly add support for git to Xcode.
Xcode 没有公共插件 API,所以没有,没有办法直接向 Xcode 添加对 git 的支持。
You can, however, create scripts for Xcode's script menu that can perform various git operations.
但是,您可以为 Xcode 的脚本菜单创建可以执行各种 git 操作的脚本。
回答by Jasper Bekkers
Well, there is this thing called git-cvsserver that lets git pretend it's CVS. But I don't know the state of affairs concerning that, or CVS support in Xcode.
嗯,有一个叫做 git-cvsserver 的东西,它让 git 假装它是 CVS。但我不知道这方面的情况,也不知道 Xcode 中的 CVS 支持。
回答by Chris Stewart
I don't believe there's a way to provide plug-in support for Xcode. So, until Apple warms up to git, we'll be stuck with 3rd party tools and the command line. Not that that's a bad thing...
我不相信有一种方法可以为 Xcode 提供插件支持。因此,在 Apple 开始使用 git 之前,我们将一直使用 3rd 方工具和命令行。不是说这是坏事...
回答by jschank
The latest Xcode 4 beta has git integration, however, it does not install it by default, neither does it use your currently installed git.
最新的 Xcode 4 beta 具有 git 集成,但是,默认情况下它不会安装它,也不使用您当前安装的 git。
What I had to do was install the "System Tools" option in the Xcode installer. (Which is skipped by default) after that, the organizer recognized that my project was already under git control, and integrated smoothly.
我必须做的是在 Xcode 安装程序中安装“系统工具”选项。(默认跳过)之后,组织者认识到我的项目已经在git控制下,并且顺利集成。
回答by Robert Conn
With Xcode 4 if you want to use your own version of Git you can create a symlink from /usr/bin/git to wherever you have installed your Git binary
使用 Xcode 4 如果你想使用你自己的 Git 版本,你可以创建一个从 /usr/bin/git 到你安装 Git 二进制文件的地方的符号链接