XCode 4 brings us GIT support (XCode 4.1+ now also brings us GIT server support). That’s great! For a new project just tick the “Create local GIT repository…” check-box in the new project dialog.

But what about older projects? Enabling GIT for an older project (or a new project you forgot to tick the “Create GIT…” check-box) is not very difficult, but we do need a terminal window for this. This is how to:

  • Open a terminal window
  • Go to the project dir you want GIT enabled
  • Execute the commands: “git init”, git add . , git commit -m “Initial comment”

Example:

cd /Projectdir  //The project dir you want GIT enabled
git init
git add .   //(include the dot!)
git commit -m "Initial commit.”

If you open this project in XCode 4, you will find it is GIT enabled.
More GIT info can be found at these links: