Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop XCode 4 from modifying a local Git repository?

Tags:

git

xcode4

I have a Git repository, which for my own reasons I want to manage outside of XCode 4. Really what I want is XCode to just leave my repository alone. However, I've noticed that XCode will add new projects to the repository if they're saved inside the repository.

For example, suppose I start out with a plain ol' repo:

mkdir gittest; cd gittest
git init; touch a; git add a; git commit

I fire up XCode and create a new project. NOTE: I do not have the "Create local git repository for this project" checkbox checked. For the destination dir, I save it to the directory gittest.

git status reveals:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#   new file:   gittest/gittest.xcodeproj/project.pbxproj
#   new file:   gittest/gittest/en.lproj/InfoPlist.strings
#   new file:   gittest/gittest/gittest-Info.plist
#   new file:   gittest/gittest/gittest-Prefix.pch
#   new file:   gittest/gittest/gittestAppDelegate.h
#   new file:   gittest/gittest/gittestAppDelegate.m
#   new file:   gittest/gittest/iPad/en.lproj/MainWindow_iPad.xib
#   new file:   gittest/gittest/iPad/gittestAppDelegate_iPad.h
#   new file:   gittest/gittest/iPad/gittestAppDelegate_iPad.m
#   new file:   gittest/gittest/iPhone/en.lproj/MainWindow_iPhone.xib
#   new file:   gittest/gittest/iPhone/gittestAppDelegate_iPhone.h
#   new file:   gittest/gittest/iPhone/gittestAppDelegate_iPhone.m
#   new file:   gittest/gittest/main.m
#
# Changed but not updated:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#   modified:   gittest/gittest.xcodeproj/project.pbxproj
#
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#   gittest/gittest.xcodeproj/project.xcworkspace/
#   gittest/gittest.xcodeproj/xcuserdata/

It's clear that XCode is modifying a git repository that it has not been told to manage.

Has anyone encountered this before? I'm assuming that this is a feature and that there's some preference to disable it, but for the life of me I can't find it.

like image 937
Tom Avatar asked Jun 16 '11 21:06

Tom


2 Answers

I've experienced this annoyance as well and wish there were a way to disable it totally, however the only short-term solution I found was to do the following:

Window -> Organizer -> Repositories

Remove the entry for your repo and the IDE won't modify the repo. I have to do this every time I open an XCode session. I hope some one has a better way!

like image 80
keno Avatar answered Nov 05 '22 03:11

keno


For those having this problem and using xcode 6 its much easier.

Preferences -> Source Control

and then uncheck "Enable Source Control" or just uncheck add and "Remove files automatically".

like image 39
j0n Avatar answered Nov 05 '22 04:11

j0n