RobertL
RobertL

Reputation: 14874

Xcode 8: how to add a GIT repository to an existing project

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.

Upvotes: 3

Views: 5499

Answers (1)

VonC
VonC

Reputation: 1323183

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.

Upvotes: 3

Related Questions