3

When I created this Xcode (Swift) project I forgot to check "Create Git repository". I spent many hours getting the first part of the project working and then realized I can't do a GIT commit. Is there some way to correct that oversight? IOW is there a way to change an existing Xcode project to include a GIT repository?

Usually I make a GIT commit right at the beginning but I obviously forgot to do that.

I'm not going to spend the time to learn GIT command line commands. If that's what it would take I'll instead make a new project that includes a repository and copy everything into it from the existing project. I've done that before but it's not quite as simple as it sounds.

RobertL
  • 14,214
  • 11
  • 38
  • 44

1 Answers1

3

Check if you have enabled Source Control in your existing XCode project.

Xcode > Preferences... > Source Control: check the Enable Source Control box.
That will give you access to Git menu commands.

For a full tutorial (XCode only, not git command line), see "Using Git with an existing XCode project" (answer starting with "Xcode 7 (and 8)")

XCode 8 commit dialog

The OP RobertL adds in the comments:

that answer misses one thing, namely that it puts only one file into the repository, not all of the project files.
If you make a change in every file in the project and commit again they all get into the repository.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The first part of "Using Git with an existing XCode project", with the answer that is green checked, is obsolete. But the last answer marked with "Xcode 8", and not green checked, is good now. Even that answer misses one thing, namely that it puts only one file into the repository, not all of the project files. If you make a change in every file in the project and commit again they all get into the repository. – RobertL Jul 16 '17 at 11:58
  • @RobertL Thank you for the feedback. I have included your comment in the answer for more visibility. – VonC Jul 16 '17 at 15:59