1

How can/should one place an Xcode 5 workspace under (git) version control?

For this I would normally expect to right-click on the in Xcode's Project Navigator and then select Source Control | Add Selected Files. But the workspace folder does not show up there (nor does it apparently in the Source Control menu). Besides, my workspace folders sit next to (not above) the project folders in the filesystem.

So do I have to/should I do version control for the workspace folder on the command line (i.e. outside Xcode), or can Xcode help me (also) in this regard?

My exact version of Xcode is 5.0.2. And here is an abstract view into my file system:

WORKSPACE.xcworkspace/
PROJECT_A/.git                 (as already managed by Xcode)
PROJECT_A/.gitignore
PROJECT_A/PROJECT_A/
PROJECT_A/PROJECT_A.xcodeproj/
PROJECT_A/PROJECT_ATests/
PROJECT_B/.git                 (as already managed by Xcode)
PROJECT_A/.gitignore
PROJECT_B/PROJECT_B/
PROJECT_B/PROJECT_B.xcodeproj/
PROJECT_B/PROJECT_BTests/

The .gitignore files are currently one-liners:

.DS_Store
Drux
  • 11,992
  • 13
  • 66
  • 116

1 Answers1

-1

its because of your .gitignore file:

*.xcworkspace
!default.xcworkspace

I think its not a good idea to store them in your git repository but if you want to, just delete the two lines from your gitignore file and commit your changes again.
For more about gitignore and a sample file: Git ignore file for Xcode projects

Community
  • 1
  • 1
zero3nna
  • 2,770
  • 30
  • 28
  • But where does the tutorial mention workspace folders? I familiar with the basics. – Drux Dec 16 '13 at 10:51
  • Thx for your effort, but you are making wrong assumptions about my `.gitignore` file :) – Drux Dec 16 '13 at 21:21
  • git is pushing everything thats in your local folder to the repository. so if workspace isn't in your .gitignore list, its not on your local git repository folder. can you post your .gitignore file? is your `workspace` file in the same folder like your `xcodeproj` file? ... i'm realy trying to help you. – zero3nna Dec 19 '13 at 12:32
  • 1
    Xcode does not create a repository for the workspace, just for each project. The .gitignore is not causing this. I'm guessing @Drux edited his question to show the file structure after your answer though... I don't see putting the workspace file in the same folder as one of the projects as a good solution. I think the answer is to do version control outside of Xcode for the workspace, but that it should be something Xcode should do natively. – Oliver Apr 23 '14 at 07:17
  • @Oliver your right, he edited his answer afterwards. And you totaly right that its a bad idea to store the workspace in each project. I think its worth to take a look at git itself. Messing with git and xcode at the same time is a little hard in some cases. For myself I totaly use git seperatly to version control my projects and workspaces. If you get used to it with the console, you have much more control about it and can do even more things then xcode currently support of git. But anyway its up to you if you like to give it a try or just dont like to use it outside of xcode. – zero3nna Apr 24 '14 at 18:07