Xcode 4 with native GIT support / How to (local with terminal usage most of the time)
sorry, but I need a little help with Xcode 4 and git. I just switched to Xcode 4 BECAUSE it supports git, but by now I don't know how to set it up right.
I would like to use the terminal most of the time, as the UI of Xcode is to slow to use instead of a quick
$ git co master
or so, but I开发者_运维技巧 would like to use the pretty handy diff and maybe also commit function Xcode comes with.
If I let Xcode set up the local repo, I can't find it with terminal, if I set the repo with the terminal, I can't figure out how to tell Xcode "there is a repo, please have a look and get a notice of all the branches". Instead it creates it's own local copy so I have two visible, accessible but independent project folders.I googled, but I can't find a good tutorial for a local repo (later on I'll try to add a remote repo too^^). Is there any understandable documentation of how to do set up git with Xcode 4 that will work nicely with any changes/commits/tags I'll do within the terminal?
I know that I'll get the "the file disappeared" message when swithcing branches, but I'll also get that if I switch through the Xcode UI, so I gotta deal with that (side-question: I never had to, but how can I join all those people asking Apple to implement that the files that do not exist in the new branch just silently close, instead of annoying me with popups?)
Thanks!
Okay, I managed to get this done, although I find it quite confusing to get there, this is the way I set up projects (from now on), to use git from the terminal most of the time, but having the option for the Xcode-Diff and commit:
Create your folder.
Create a Subfolder
(everything in the subfolder will be subversioned, everything in the some level as this subfolder, aka inside the folder won't.. I always need that)
create your .gitignore (the content of gitignore will be listed at the end)
add another file, eg. a ReadMe.rtf
in terminal, set up your git like usuall with:
$ cd <path to your subfolder>
$ git init
$ git add .
$ git commit -a -m "Your commit message"
switch to Xcode, create a new Project like file->new->project (you should not be able to set up a git repo through this dialog any longer, the check box should be disabled)
Check back inside the organizer, there should be a repo called like your Subfolder.
To add a remote repo, just do as usual in Terminal.
The .gitignore content:
.svn/entries
build
.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
//for xcode 4
xcuserdata
//User-specific project settings
*.mode1v3
*.mode2v3
Hope that helps someone else too :)
精彩评论