How do I remove multiple git source controls from my project? - xcode

I was dragging some files from an Xcode project to a new Xcode project. Then I notice on the new Xcode project. There're now 2 source controls listed, one from the first Xcode project. The delete keyword is greyed when I right click on it.
How do I remove the git reference from the first Xcode project?

Weird af. All I had to do was move the new Xcode project to any other folder. Then the extra working copy reference disappears.

Check if you have dragged also a .git subfolder: that would explain the second repo being "created/visible" after your file move operation.
Removing that extra .git subfolder in your second directory (the one created by the move) should be enough to resolve the situation.

Related

Why can't I delete this file from my Xcode project?

Being new to Xcode, I foolishly added "wrong_answer.mp3" via "add files to.." to my project and in the wrong place, but I cannot remove this reference from my project. I deleted the underlying file from the file system, but I cannot find in Xcode where I can remove this reference... Can someone advise how to remove this reference from my project ?
UPDATE: Yes, I have tried delete/backspace and edit menu "Delete".
Some options
Restart Xcode
Clean project, Product—>Clean
Put the file back and delete it from Xcode

Clean Build and references

This seems pretty straight forward but how do I update a build or maybe whats it called "clean"? Basically sometimes I will move a .H and .M file to a new folder in xcode project navigator. In xcode it shows the files have moved but in Finder the are not moved into the new folder thus in xcode I still have to reference files (like #import "blank") as if it was in the original location even though it shows the files are moved in Xcode. This seems to be the case if I delete files xcode fails cause it is say the file is still there. Does cleaning update the build references??
xcode groups and the filesystem are not 'connected'
moves of files in xcode don't affect where files are / need to be on the filesystem and vice versa.
what I always do is move files on disk, then REMOVE and READD them in xcode

Can't delete or rename files in Xcode 4.6 Project Navigator?

Something has become buggered with my project.
I can't delete files or rename files from Project Navigator view.
It may have something to do with source control? If I highlight 5 files in Project Navigator and hit delete and then move to trash the first file gets a source control "D" marking beside it but all of the files still remain.
Restarting mac/xcode has not resolved it. Any ideas?
Same thing happens to me for a while now.
Using git.
So far I'm able to work around this by deleting the files one at a time, which moves the file to trash but doesn't remove the reference. And then deleting the references again.
Similar problem with adding files to the project and renaming them.
For adding: first move/copy the required file in the project folder to the desired location, and then add from Xcode deselecting the "Copy items..." checkbox.
For renaming: find file in finder, rename IN FINDER, then change the name accordingly in Xcode (or choose the file again from the right panel).
Hopefully we won't have problems like these after moving to Xcode 5.

File in the project not seen by Xcode after Git pull

A partner and I are managing an Xcode project via Git. He recently "localized" the project, which added a directory for German ("de.lproj") to the project with a number of files. After I pulled those changes over to my copy of the project, Xcode now fails to compile complaining that two files in this directory don't exist. These files are present in the filesystem, but displayed as red (missing) in the Xcode sidebar.
Is there a way to force Xcode to rebuild it's internal catalog of files so that it can "rediscover" that these files are, indeed, present?
Note, I've tried a fresh "clone" of this Git project as well, same result.
I found a solution without removing the file from Xcode -
In the Project Navigator, locate the file (colored red for not being found) and highlight it.
Show the File Inspector
Under Location change Absolute Path to Relative to group or Relative to project,
Then next to the path, there's a little white icon, click it and choose the file's location.
This turned out to be a case of absolute vs. group paths memorized in the project.pbxproj file by Xcode. For reasons I do not understand, when my partner localized our project, some files were added to Xcode using absolute paths. When I pulled that version of the project, my copy of Xcode could not find those files because the absolute path did not match my absolute path. Even though the files were in the project and transferred properly by Git, Xcode could not find them.
My solution was to use Xcode to delete these files. Since these were localized files, I actually had to delete the "parent" version of the localized files. I told Xcode to only remove the references to the files. Then I dragged the files from Finder back into Xcode. This time Xcode inserted them as "relative to group" and all was well.
I committed and pushed those changes back to our remote Git repository. My partner was able to pull those to his copy and all worked for him too.
Neither of us understand why the files were inserted as absolute references in the first place, but at least we were able to use this workaround to make the project portable again.
I had this issue and i fixed it just by quitting xcode and reopening it. All the missing files magically reappeared. Hope this will help some one.
Check the project folder path. If any of the folder name in the path contains a 'space' then remove it and open the project again. I had this issue with Xcode 9.

How can add resources like images to source control under Xcode 4

Xcode 4 does not automatically add images to the source control (git), also option to add files to source control is disabled in the context menu when I select an image.
Is there something I am doing wrong or will I need to add those files to the repository by some other means.
Thanks
It seems like only way to add those files is from command line via git then Xcode tracks them properly. And I just did that and it works.
Xcode 4 doesn't seem to add any files to the GIT at all with the project navigator "Add files to ..." command, this seems ridiculous.
To demonstrate the problem, simply create an iOS project of any type. Copy a folder of source code into main project folder and then right click the project and select Add Files to . No matter what you select when adding the folder (group/folder) Xcode doesn't add them to the git.
Creating new files within Xcode does add them to the git of course.
Help anyone?

Resources