When you create an Xcode project for the first time you can create Git Repository on your mac. But this step can also be done after creating your project by navigating to your bar items and going to “Source Control” then clicking on “Create Git Repositories…”.
Create a new App Create a new Single View App. Make sure that the Create Git repository on my Mac tick box is selected (if this is missed it is possible to add later through the Source Control menu within Xcode).
Here's a way to install git on Mac OS X without XCode. Adding the directory to the path will prevent Mac OS X from aksing you to install XCode each time you type git in the terminal.
Push your projectGo to Source Control in Xcode and select Projectname -- master, then Configure... In the Address field, paste the Git clone URL for your repo copied in the previous step. Select Add Remote, then select Done to finish creating the origin remote for your local Git repo.
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.
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.
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.
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.
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 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With