Because me and my team started playing with the files that were included and ignored on the XCode Commit panel, our project has become very hard to manage on git. Since we added some libraries that we installed through cocoapods into git and uploaded them with the project, we have consistently gotten errors with files that don't show up on the user that pushed it, or other that show as missing for the user that made the pull.
To solve this, I want to take the most up-to-date branch, and reset git or the gitignore file in order to reupload to another origin from scratch, and hopefully have an easier time with our collaboration.
I haven't found a way to do so easily and safely. Is there a way to do so?
Thanks in advance.
If you want to go back to a standard gitignore file for your Xcode project, go to gitignore.io and enter Xcode in the search field. That will generate a standard gitignore file for Xcode projects.
Open up your existing gitignore file in a text editor. Replace the contents with the contents of the file gitignore.io created for you. Commit the gitignore file and push it to your remote repository. Now your team will be working with a standard gitignore file.
Whenever i commit and push project.xcodeproj file, git not able to identify project.pbxproj because it is not showing on remote branch.
If i do some changes in project like add a new file or change project settings etc. but still git unable to identify any changes in project.xcodeproj.
Please help me out.
Finally i got the solution,
I move in project.xcodeproj bundle and forcefully add project.pbxproj file by using below command
git add -f project.pbxproj
Because the project.pbxproj file is packed and embedded in the project.xcodeproj bundle.
You change it , and git add it.
Git not able to identify project.pbxproj because it is not showing on
remote branch.
I think you need some Plugin to open file in Github, like fugitive.vim .
I have been suffering from my project and the latest Xcode 8, it seems to be i can't find this file .xcscmblueprint that contains the source control details of my project.
There is some conflicts in that file and even if i deleted the git from my Xcode project it wont be fixed unless i fixed it from that file.
i am also using pods with this project and i tried a lot to find it but i couldn't and also in this location is not generated and not found :
ProjectName > ProjectName.xcworkspace > xcshareddata >
ProjectName.xcscmblueprint
So how is it possible to generate or find this file ?
Update:
The main problem I'm facing with my git in the Xcode project is that the repository issue (scenario):
1- I have edited one class in the project.
2- i went to commit my changes in Xcode.
3- i get the following message :
4- In order for me to fix that i close Xcode completely and open it again and without changing anything.
5- commit and push the code successfully and Xcode doesn't complain about the repo.
I tried to clean the Xcode project, remove the git from Xcode and re init a new git, its the same issue over and over and i just can't seem to fix it ones for all.
Any Suggestions ?
I upgraded from Xcode 7.3 to Xcode 8.0 and changed syntax from swift 2.3 to swift 3.0. I am able to build the project and run fine but I got some 233 warnings all about images I used in Assets.xcassets.
I realized that the path is wrong as I changed the name of my project from projectA to projectB and the path is referring to an invalid path which is
/Users/name/Desktop/projectA/projectB/Assets.xcassets/Images/img_01.imageset/img_01#2x.png is missing from working copy
I believe that I have to remove name of those files from my sourcecontrol as they are not valid anymore. I have committed all my changes and have no idea how to remove these missing file links to get rid of those warnings.
I was able to solve this after a lot of research.
I went to projectB.xcodeproject > Show package contents > project.pbxproj > xcuserdata. Delete the xcuserdata.
Then go to Source Control > Commit
Commit all changes. Since the path doesn't exist, Xcode will not commit changes; so just cancel out of it and do
Source Control > Refresh Status
Then exit out of Xcode and restart it.
Start terminal, go to the project directory, call:
git commit -a -m "some hints"
After restarting XCode the message should be gone. I think XCode is calling git commit without -a option
The only thing that worked for me was to open the .xcodeproj and then Option key (on keyboard) + (Product (top menu) -> Clean Build Folder)
Note. Even if you are using cocoapods and usually open the project with .xcworkspace, you still need to perform above with .xcodeproj
In your XCode Projects Folder write "git add ." and then commit it. If you have erased some project you should use "git add -u ." and then commit it again.
This worked for me!
If you are using CocoaPods, you might need to do what learner122 said in your projects Pods directory, as well.
Almost the same as above poster, but I didn't have to delete the XCuserdata file:
Commit dialogue
Manually selected the missing/unrecognized Swift file
clicked Commit files
and "Refresh Status"
the error message disappeared. All good.
After deleting/adding some png files to project, i have got messages when building project.
"file ProjectPath\aaa\xxx.png is missing from working copy."
All these files are in the project, and the application is running. However, these messages are annoying. Looked .plist file, but there is no mention of these files.
What should I do to remove these messages?
The warning will disappear as soon as you commit your changes (Xcode 8).
It seems that this problem may have different causes, but it's often in relation with source control software.
In my case, I solved it by going to Git, and adding the files again. I mean running the following command:
git add .
You can also disable source control by unchecking
Xcode -> Preferences -> Source Control -> Enable Source Control
if you're managing it via command line or any other app.
In XCode -> SoureControl:
Update + Refresh Status did it for me.
In my case, the file was missing from the source control.
To fix, I had to discard this file (be careful only discard the missing file not all your project):
Xcode->Source Control->commit
Right Click the missing file
Choose Discard Changes
Disable Source Control, clean build folder (Alt+Shift+Cmd+K), then Enable Source Control again.
Xcode -> Preferences -> Source Control -> Enable Source Control
In my case, Xcode had somehow found old .svn directories that referenced the missing files. I had to go up a level above my project folder to find those .svn files. Once deleted, I restarted Xcode and everything was fine.
I had a similar issue with a handful of files that had long since been deleted from my Xcode project while I was still using Xcode 7.
My solution was to:
Create files with the names Xcode was complaining about (they don't need any content)
Add the files to my Xcode project (in Xcode right click on my main project directory, click Add files to my_project_name and select the files that were just created
Select the newly added files and delete them - select move to trash.
This got rid of the warnings for me.
To add onto Alexander Vasenin's answer...
First I Committed and Pushed my changes
Xcode Main Menu > Source Control > Commit
Then I Discarded All Changes to get rid of the errors
Xcode Main Menu > Source Control > Discard All Changes
After that, the errors stating "file xxx.png is missing from working copy" disappeared.
This is occurred when you delete file on Xcode, but didnt tell svn server about it.
Go to command line tool, and delete file directly.
svn delete missingFile.m
and commit it
svn commit -m "Deleting file"
note that if you delete .svn folder, the warning is disappear but you will lost communication with svn server.
I worked it out.
just open your third-party SVN tool, find the miss files, Revert;
that's all.
I had same problem and solved it by add git .
Open Command Line Tool
cd "project folder path"
git add .
Later,restart Xcode project and open your project again.
Show on target->build phases -> copy Bundle Resources.
and
clean build folder command+shift+alt+k
I had to manually go into Terminal and remove the files with git rm ProjectPath\aaa\xxx.png and then commit. After that everything worked fine.
Got this for every project after moving on to XCode 8. This solved it:
With Option Key pressed, Product (in title menu) -> Clean Build Folder.
In my case, I had wrong data from my old projects in the simulator. Solved by reset content and settings in the simulator:
Simulator -> Reset content and settings...
For me the following worked:
Since I do not and did never use Git, I created a new project (XCode 8, I could not see the usual "use Git" or however the checkmark was labeled). Then I bluntly deleted all the files in this new project; went to the old messed up project, copied everything in the project folder, came back to the newly created project, pasted the old stuff, opened that - all the warnings about files that have not been existing for months are gone. Fingers crossed.
I had the same issue and solved it by simply dragging the specified files from finder into the project navigator (ensuring that "copy files" is selected in the dialog) and committing the files.
These warnings are not build warnings, they are about your SVN repository.
It is correct that the directories shown no longer exist, CocoaPods stores the headers in Pods/Headers/{Private,Public} now. You have to update your working copy to reflect those changes.
In my case I drag & dropped a number of files on my Xcode project window to add them. It made copies into my source directory but didn't put them where I wanted them to go (it put them at the root of my directory, I wanted them in a sub-directory). Without thinking I just grabbed them in the Finder and moved them to the directory I wanted them in. After going back into the project window it of course could not find them so I deleted them in the window and re added them. After compiling I started getting these errors.
I thought, as some mention above that it was a git issue but when I ran "git ls-tree --full-tree -r HEAD" I didn't see the files at all??
Anyway to fix it all I did was use the "Add File..." menu command to add each of the files to the default location, do a clean build, and then delete them from the project window (using move to trash) and it got rid of all the errors.
I had the warnings, and also could not commit changes under XCode (using svn). All I had to do was restart XCode and the problem went away.
This works for me:
Xcode -> ("option + click") Product -> Clean Build Folder...
Than restart xCode
In my case it was a problem with git and a case-insensitive file system.
I had inadvertently submitted the same file twice, using file paths that differed only in case:
MyProject/Resources/foo.png
MyProject/resources/foo.png
Xcode was complaining about one of the missing files.
Fixed by deleting the offending files, and re-adding.
cd MyProject
mv Resources/foo.png /tmp
git rm Resources/foo.png
git rm resources/foo.png
git commit
mv /tmp/foo.png Resources
git add Resources/foo.png
git commit
This is definitely related to source control. I renamed and moved a couple of non-committed plist files and got this error. I am using svn. I was able to fix this via Source Control - Commit by removing old referenced files.