tags:

views:

21687

answers:

12

Is there any way to use a git repository with the built in SCM functions of Xcode?

+58  A: 

There's no git support within Xcode, 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.

Shane Vitarana has a nice set of .gitignore settings to use as a starting point.

Abie
No support for git in Xcode 3.x and earlier.
Michael McCarty
some ones to add for Xcode 4:*.xcworkspace/xcuserdata/
TodK
+3  A: 

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.

Jasper Bekkers
+3  A: 

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...

Chris Stewart
+9  A: 

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.

Daniel H
+4  A: 

Xcode doesn't have a public plug-in API, so no, there's no way to directly add support for git to Xcode.

You can, however, create scripts for Xcode's script menu that can perform various git operations.

Chris Hanson
+9  A: 

In addition to the .gitignore settings referenced from the post above I have added the generated files to my config file.

build/
*.pyc
*~.nib/
*.pbxuser
*.perspective
*.perspectivev3

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.

Mark Thalman
+28  A: 

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.

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).

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.

I have no connection at all with Decimus. I am just a satisfied user who has run thousands of commands through 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

Mark Thalman
Mark - you have no idea how happy you have made me. I cannot believe I've been living without DTerm all this time!
Mark Aufflick
I ran into a small thing: it is cmd-shift-V rather than ctrl-shift-V.
Courtney Palit
A: 

I am wondering, if a wrapper can be done using xcode scripting features ? check : http://www.cimgf.com/category/version-control/git/

btw, if xcode can not do the job, eclipse can do the job but it may lack cocoa api etc ...

rzr
A: 

I use external editors anyway. Many of them support git commands. In this way, git is "integrated" into Xcode

Yan Zhou
can you give an example of external editors with git integration on mac?
Zaki
+20  A: 

XCode 4 will support git natively (Developer Tools State of the Union Address at WWDC 2010)

Edit: Apple has released this info to the public: What's new in XCode 4

TodK
That's awesome to hear. Any word on Mercurial (hg) support?
Dave Gallagher
it doesn't appear so... no word on a plugin system.
TodK
:D This made my day! Can't wait.
Vortico
OMGEEZ! I had no idea...This makes me very happy...any word on release date?
tybro0103
+3  A: 

The latest XCode 4 beta has git integration, however, it does not install it by default, neither does it use your currently installed 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.

jschank
+1  A: 

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

Robert Conn