Can git be integrated with Xcode?

60,636

Solution 1

Xcode 4 supports git natively (Developer Tools State of the Union Address at WWDC 2010)

Learn more here: What's new in Xcode 4
The documentation from Apple is lengthy, but a good read.

Solution 2

NOTE: despite all the up-votes, this answer is out of date as of June 2010


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.

Solution 3

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

Edit 2: DTerm is 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.

Solution 4

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

Solution 5

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.

Share:
60,636
Gordon Wilson
Author by

Gordon Wilson

Software enthusiast

Updated on May 16, 2020

Comments

  • Gordon Wilson
    Gordon Wilson about 4 years

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

  • Mark
    Mark over 14 years
    Mark - you have no idea how happy you have made me. I cannot believe I've been living without DTerm all this time!
  • Courtney Faulkner
    Courtney Faulkner over 14 years
    I ran into a small thing: it is cmd-shift-V rather than ctrl-shift-V.
  • Dave
    Dave about 14 years
    That's awesome to hear. Any word on Mercurial (hg) support?
  • TodK
    TodK about 14 years
    it doesn't appear so... no word on a plugin system.
  • zakishaheen
    zakishaheen almost 14 years
    can you give an example of external editors with git integration on mac?
  • Vortico
    Vortico almost 14 years
    :D This made my day! Can't wait.
  • tybro0103
    tybro0103 almost 14 years
    OMGEEZ! I had no idea...This makes me very happy...any word on release date?
  • Yuji 'Tomita' Tomita
    Yuji 'Tomita' Tomita over 13 years
    Dterm is absolutely amazing!!! -- when it works. It's very buggy with their latest version and 10.6.6 latest. I would kill to have this working right!
  • Mark
    Mark over 13 years
    Try deleting the preferences file. I have had no problems with it. I have been using it for a long time. Is your login using English as the language and character input?
  • jkyle
    jkyle almost 13 years
    Adding these two to my .gitignore causes broken xcode build for clones.
  • Admin
    Admin almost 5 years
    Doc link is broken