I have a project I have been adding files to regularly and noticed recently that only some of the files are being managed by the local git repository. In other words, when I modify some of the files, there is no indication of source control status (like ‘M’).
The files that are exhibiting this behavior are ones created by making copies of existing files in the project outside of XCode. For example, I would go out to finder and make a copy of a file already in the project, rename it, and go back into XCode and add the file to the project.
When I right-click on these files in XCode and choose Source Control, every menu item is grayed out. I can’t even add them to source control.
I have a feeling that copying a file already in the project caused a problem, but I have no idea how to fix it. I have read that I can recursively remove source control from a project by issuing a bash command, but I would really rather not lose the source control history I already have.
Thanks in advance for your help.
I couldn’t reproduce this in XCode 4.2. Manually adding the files to the git repository should work – but I can’t test this.
Steps to manually add files to the git repository:
git status, which should tell you which files are currently untracked.git add -A– this will add all untracked files, and remove any files which have been deleted from the git repository.git add <filename>.git commit.Once this is done, XCode should recognize that the files are being tracked and let you commit changes via the XCode source management commands.