iPhone: How to re-create XCode built-in git repository?

Solutions Collect From Internet About “iPhone: How to re-create XCode built-in git repository?”

Having just renamed my project, this was an interesting question 🙂

I called up the commit dialog, and everything looked good, but on committing, I got the same problem. It looks like the project name doesn’t add the new project directory to git. ( You did change the project name through Xcode didn’t you, if you didn’t, I’d rename it back and then change it through Xcode.)

First of all, since you’ve rebuild the repository, I’ll address your problem.

The chances are that the problem is that the project is not added to the repository. If you have ‘?’ marks next to your files, you just need to do a Source Control | Add for the files ( and the project) in the File Browser.

If this doesn’t fix it, you may have the old project name checked into the repository ( I don’t know if delete from Xcode really deletes the old repository or just unregisters it.
I had this problem and fixed it from the command line

cd <project directory>
git rm <old project name>.xcodeproj

That last command gave me an error, but did seem to remove the offending entry from the repository.

Hopefully, you’ll be up and running now.

I fixed the problem by working on the old repository, so what I did is for other people in a similar position.

( This is mostly command line stuff)
// In Xcode, add the project to git: right click on the project in the files browser and source control|add. This should make the ? go away.

// Add the git directory to your path
// go to your project directory, for me that was something like
cd ~/Projects/<project name>

git rm <old name>.xcodeproj

git commit -m "<commit message"

There were a couple of source files that didn’t commit, so I committed them with right click on the file and committing them on their own. Once I had a clean project, I made a change to one file and then did a commit through the file menu to check the complete project was committing and it was.