Murray Sagal
Murray Sagal

Reputation: 8654

Why doesn't Xcode create a .gitignore file?

I'm aware of how to create one and there are lots of posts of what should be in them for an Xcode project. This is a more basic question.

Assume that I'm just working locally, I haven't created any remotes.

Upvotes: 4

Views: 5721

Answers (1)

Murray Sagal
Murray Sagal

Reputation: 8654

I'm pretty sure that Xcode does not create a gitignore file on its own. So this is how I start a new project now.

  1. Create a new project in Xcode. Do not create a local git repo. The problem with getting Xcode to create the repo is that it performs an initial commit before a gitignore file is created. I prefer to add gitignore before the initial commit.
  2. Close the project.
  3. In Terminal, navigate to the directory containing the new project.
  4. git init
  5. curl https://www.gitignore.io/api/xcode > .gitignore There are lots of places to get gitignore files but this is super handy as shown on NSScreencast episode 156.
  6. git add . Be sure to include the dot, that adds everything.
  7. git commit -m “Initial commit."
  8. Open the project in Xcode and inspect the Source Control menu. If you select History you should see the initial commit.

Update:

www.gitignore.io now redirects to www.toptal.com/developers/gitignore

It's nice. You can specify keywords like xcode, cocoapods, etc.

Upvotes: 19

Related Questions