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

て烟熏妆下的殇ゞ 提交于 2019-12-11 08:46:57

问题


I want to use git in XCode for iPhone app development.
I began to use it from few days ago.

But after renaming XCode project name, commiting doesn't work anymore.

So I tried re-create repository of git.
I could delete old repository and could create new repository with XCode's Organizer.

But I don't know how to use new repository from the project.


回答1:


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>
PATH=$PATH:/Applications/Xcode.app/Contents/Developer/usr/bin/
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
PATH=$PATH:/Applications/Xcode.app/Contents/Developer/usr/bin/
// 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.



来源:https://stackoverflow.com/questions/11468041/iphone-how-to-re-create-xcode-built-in-git-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!