Git with Xcode, no such file or directory - iphone

I've been searching around and looking for answers but I haven't found something that works yet. I apologize if this is easy and someone has already answered this as I'm new to Git.
What happened was there was a branch both my coworker and I were using. There was a conflict when I tried to commit (I honestly can't remember if it was committing or when I Pulled in her changes). Basically we were both deleting unused files, images, etc. I went through the conflicts and I thought I went through it properly accepting both of our changes, but something still might have gotten messed up because I'm getting
No such file or directory
For a specific image. These are some of the things I tried, with cleaning and rebuilding after I have tried one of these which have not worked.
- Adding the image back to the project (Xcode still thinks its missing and doesn't update it's .xcodeproj)
- git reset HEAD <file>
- git add <file>
Nothing seemed to work. When I try git status, I saw that it is an untracked file. I then removed it. I see my .xcodeproj is

$10 says the .xcodeproj doesn't recognize the existence of the image. Git does a very poor job of properly merging the .xcodeproj file, and you will often have to readd files due to a bad merge.
When in doubt, find a past version of your .xcodeproj that works, bring it to your master HEAD, and add the files that are missing from the .xcodeproj.

Related

What does the xcschememanagement.plist file do in XCode? And can I ignore it with git?

Due to the poor documentation of XCodes files that manage your project under the hood, I cannot understand the purpose of the xcschememanagement.plist file, which is causing me a lot of problems.
Can anyone explain this file's purpose, and how we should be treating it with git source control?
Here is the full path to the file PROJECT_ROOT/xcuserdata/alecmather.xcuserdatad/xcschemes/xcschememanagement.plist
My problem with git and this file:
Let's say I start on branch_1.
I make some commits to this branch.
Then I switch to branch_2.
I make some commits there, and decide to run my project.
After I'm done, I stop running my project and switch back to branch_1.
I run my project there, and close it.
I attempt to switch back to branch_2 but am stopped by git saying that I have uncommitted changes in the current directory. But I did nothing but run my project.
So I'm assuming that this file holds some things that can get changed around when building/running your project? But this gets really tedious when switching between branches all the time. Do I commit the changes to that file from this scenario? Can I safely just discard the changes?
Yes, you can safely ignore the whole xcuserdata folder. All premade .gitignore files I've seen so far for Xcode projects do so, including https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore

Git add is ignoring certain files even when .gitignore does not exist

I am facing a rather strange issue with my git working folders. Here's the summary:
I previously had a local git repo with a .gitignore file that ignored certain files/folders.
I deleted the repo (.git folder) and also the .gitignore file
Then I initialized a new one with git init in the same folder. Now when I do a "git add .", the previous ignore pattern is retained for some reason.
Even stranger,this happens with any new project following the same folder structure no matter where I place the project on my computer.
I tried deleting and recreating the files multiple times. I even created a new .gitignore file with a different pattern. It does not seem to have an effect except when it is set to ignore everything (with just * in the file)
My guess is that the .gitignore pattern I deleted is somewhere saved that I dont know the location of. If anyone has faced a similar issue or know what I could be missing, I'd love to know.
I am still new to git. Sorry if this is something very obvious that I have missed out on.
UPDATE:
I still have not found the reason for this behaviour but managed to reset everything by doing 'git add --force .' in the directory and then deleting the repo. Now I initialized a new repo that works as expected.

"Cannot publish, unborn head" error message

I know there are other questions on here about this issue, but this case is different because it's not caused by an empty repo folder or anything, and I've been pushing changes to this same repo using GitHub desktop for some time. After I type my changes into the summary window, I hit Commit to Master (branch is already set to master, like always). But I get the unborn head issue, along with the alert that my repo's name is too long. Again, this has never happened, and the name has never been an issue previously. Here's a screenshot for reference:
Does anyone know what might be causing this?
The error is due to a file in "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/AppData/Local/Microsoft/VisualStudio/15.0_8067392e/VTC/" having a name that is too long. The filename looks like it is generated by a tool, not written by you. In fact it looks like the whole "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/AppData/Local/Microsoft/" directory is probably not code that you are working on yourself.
With version control, it is best to ignore any files and folders that are generated somehow, such as this "Microsoft" folder. With git, you can do that in your .gitignore file with the following line, assuming that "Desktop/MY REPOS/The-Tech-Academy-C-Sharp-Coding-Projects/" is your project root:
AppData/Local/Microsoft
In fact, if "AppData" contains only generated files, then you can even ignore just that.
I was using Sublime Text ver 3.2.1 working on a fresh copy of laravel in wamp. I had this issue of 'cannot publish unborn head' when using GitHub Desktop to publish for the first time. Solved by typing something in the title under Summary. As an aside, I included .editorconfig in my gitignore file.

Mercurial: Can you track changes across a file that has been renamed to another tracked file?

I know that you can track changes to renamed files from a repo to it's clone. However, I seem to have an issue when I rename a file to a file name that is already being tracked. In essence, I want to copy over a tracked file.
Files in original repo:
application.txt
special.txt
Then clone the repo, delete application.txt and rename special.txt to be application.txt
I would expect that the next time I made changes to special.txt in the original repo, the changes would carry over to application.txt. However, it doesn't. I get this message
local changed special.txt which remote deleted
use (c)hanged version or (d)eleted?
Trying this same thing out in Git seems to have the same results. Renaming a file to a brand new name has no issues while trying to rename a file that has already been 'taken' causes conflicts. Is there any way around this?
I wouldn't really call this a bug, as you have for all purposes just changed the contents of a file that mercurial is already tracking. Mercurial tracks files by file name and extension, and you could make the case that this is no different than just replacing the entire contents of the file.
I just had this problem in a real world project with Mercurial. GIT is also seeing bogus conflicts (special.txt deleted and updated).
Bazaar has proper rename support and it merges this case correctly (changes to special.txt are carried over and application.txt get updated as expected).
The problem with Bazaar though (at least for me) is that it lacks IntelliJ support. There are 2 plugins, the most recent has not been updated for 3 years, and last time i tried it was unusable with recent IntelliJ versions.
Since "bzr mv" and "bzr rename" need to be invoked by the IDE at the time of refactoring, the lack of support makes Bazaar unusable for me.
If you want IntelliJ support for this, vote here: http://youtrack.jetbrains.com/issue/IDEABKL-5344

svn: Item <folder> is out of date

[answer auto-selected by bounty system against my will]
I'm using subclipse, and always when delete a folder in Eclipse, and try to commit it, the following errors raise:
svn: Item <folder> is out of date
svn: DELETE of <folder>: 409 Conflict (http://myintranet)
Deleting and commiting via command line works fine, but what's wrong with doing it via subclipse? Is anyone more experiencing this problem?
(I experienced this problem in Ubuntu 9.10 and 10.04; last Eclipse version; and subclipse 1.4 - as the next versions of subclipse have much more bugs)
--updated: Its when I delete folders, not files
Isn't that addressed by the Subclipse FAQ?
Whenever you see "out of date" in an error message it means that the revision of the item in the repository is newer than the copy in your local working copy.
The solution is always going to be to run an update, so that your working copy is up to date with the repository, and then do the commit again (assuming that the update did not generate any conflicts).
For files, this is usually pretty easy to understand how and why this happens.
However, Subversion also versions folders, and it is usually with folders that this problem most often happens.
Subversion does not allow you to delete/rename a folder OR change its versioned properties, UNLESS the local copy of the folder is at the HEAD revision of the folder in the repository.
Your next question might be:
"OK, I can maybe understand that, but why is my folder out of date? I am the only person working in this repository."
That is a valid question, the answer lies in the way that Subversion works.
When you commit a change to a file, the revision of the file in your working copy is updated to that new revision when the commit completes, however the version of the parent folder(s) of that file is not updated.
This is because there may have been adds/deletes to other files in that folder and until you have run an update, the folder is not really at that new revision.
This is called "mixed revision working copies".
In summary, the answer is always to do an update so that the folder or file is updated to its HEAD revision.
About "Mixed Revision Working Copies":
One special kind of flexibility is the ability to have a working copy containing files and directories with a mix of different working revision numbers.
One of the fundamental rules of Subversion is that a “push” action does not cause a “pull,” nor vice versa.
Just because you're ready to submit new changes to the repository doesn't mean you're ready to receive changes from other people.
The fact is, every time you run svn commit your working copy ends up with some mixture of revisions.
The things you just committed are marked as having larger working revisions than everything else. After several commits (with no updates in between), your working copy will contain a whole mixture of revisions
(and that is why, I believe, you cannot reproduce your "out of date" message on subsequent commits with folder deleted: your update did solve the "mixed revision" state.)
Mixed revisions have limitations
You cannot commit the deletion of a file or directory that isn't fully up to date.
If a newer version of the item exists in the repository, your attempt to delete will be rejected to prevent you from accidentally destroying changes you've not yet seen.
i think if you UPDATE before that it should work.. it did work for me
There's a simple solution without installing some extra software. I also had this "problem" and what you can do is the following:
1) open the SVN Repository view
2) there go to the folder you want to get rid of and delete it
3) go back to the java view
4) update the folder in your project you actually deleted / update your project should also work
That solved the problem in my case, as updating only retrieved the files I deleted
Subclipse has many problems like this. It works 90% of time, and then it just DOES NOT work as it should! I am using subclipse, since it is very well integrated into eclipse, and when I have problem or some bigger moves needed in svn (like merging some branch) I use Tortoisse.
I had the thing with directory like you. Then I just run the TortoiseSVN like #luiscolorado suggests, and it helped. Tortoise is so great tool (it has many great features for diffing, applying patches, getting patches and so on.).
Today I had a problem when I have removed a file, and someone had changed the same file! Then subclipse shows conflict (up to this point everything is ok), so I wanted to revert! But then the revert button is missing (disappears when inconflict mode!) so I have to do merge, and merge does not work, throws some kind of error. I didn't bother to read (maybe I should read and file it as a bug to subclipse maintainers ;-(), I knew the tortoisse will work, and you know what, it worked. There was a REVERT option.
So #Tom Brito, try command line, try Tortoisse, and then you can look at the subclipse changelog and file a bug. I think that subclipse just forgets to show us some directory changes and updates (or it is designed not to do it?), but I may be wrong.
Tom,
You might want to try TortoiseSVN, and manually update the project workspace. Find the location of your project directory in your hard drive, and then try TortoiseSVN (or the command line if it's your preference) to do the update.
A frequent cause of this problem is to delete the directory without "informing" SVN. For instance, if you manually delete the directory using the operating system instead of using SVN, you will have this problem.
If you removed the directory before you installed the subversion plug-in, but the project already existed in the repository, you will experiment this problem. A solution, in this case, would be to recreate the directory, updating/committing, and then delete again the directory.
Good luck.
My solution to this was
Delete all items in folder
Commit to repository
Update folder to HEAD
Delete folder in Eclipse
Commit to repository
A bit cumbersome, maybe, but it always works
The only working way in same cases is via command line. The subclipse is still not perfect..