Xcode 7 The source control operation failed because the revision could not be found.

Since upgrading to Xcode 7, I get the following message when committing and pushing to my Git repository from Xcode on my development laptop, a MacBook Pro.


The source control operation failed because the revision "XXXX.swift" could not be found.


My Git repository is hosted on a Mac mini also running Xcode 7.1, while my development is done on a MacBook Pro running El Capitan and Xcode 7.1.1


I have gone into Xcode->Preferences and deleted all references to the repositories, and created the project again from the repository into a new directory. If I make a simple change like adding a comment "// foo" to AppDelegate.swift and when trying to push back to the repository I get the message above, despite that pushing to the repository otherwise works fine.


All was fine under Xcode 6.x and Swift 1.2


I am puzzled that there is not more noise in the Forum on this issue

We had the same problem. Turns out it was a path issue. Some files would throw the error dialog, others would not. When we examined the files in the file inspector pane, the problem files had a subdirectory whose case didn't match that on the file system (e.g. "myproject/" vs "MyProject/"). I opened the project.pbxproj in TextWrangler, updated all occurences that conflicted (fortunately, it was only about 20 or 30 instances), and reopened the project in Xcode and the issue was resolved. You could also remove/re-add the files, but it may be faster to do it by hand as I described.


This may explain why there isn't more noise in the forum on this issue.


- Scott

Thanks for the reply Scott (@gsc). I was hoping this issue would just get fixed in Xcode 7.1.1 or Xcode 7.2. Well, Xcode 7.2 has arrived and nothing has worked for me. When I look in the File Inspector, each file has the correct path. Moreover, this issue occurs for EVERY file.

I have also tried the following with no effect:

  1. Create a new project from the repository
  2. Delete references to the files and add them again to the project
  3. Move files into new subdirectories that are named identically to the group within Xcode
  4. Create new groups within Xcode and move files from the old group to the new group.

This is definitely an Xcode problem, not a git problem. If I make a change to a source file in Xcode, "$git status" from the command line reflects the same changes. A "$git diff" also accurately shows the differences. All Github operations work fine: I can commit and push to the repository. The only next steps I can conceive are the following:

  1. Create a new project in Xcode and manually add each file.
  2. Reinstall Xcode
  3. Both of the above and create a new remote repository

Any advice on other options is greatly appreciated...

Version control operations in Xcode 7.2 are still broken, both for Git and Subversion, especially the history operations. I can't believe that the folks inside Apple aren't having the same problems and you'd think somebody there would be screaming about this.


Apple prioritizes their fixes partly based on the number of people affected by the bug. Therefore, I encourage you to file a bug report (https://developer.apple.com/bug-reporting/). If you open the Console and monitor what is happening during version control operations, you'll see the errors thrown by Apple's frameworks. Copy these and submit them with your bug report.

Try using Xcode 7.3 beta. Both of my version control problems with Subversion and Git seem to have been fixed. (As of this writing I have beta 3 installed.)

@rshuston,

have you tried merging a branch into trunk with Xcode 7.3 beta? Just curious because that is the last issue that I had with Xcode 7.2.x. I'm aware that the history viewing functionality issues has been addressed and that's great.


Thanks,


--Neal

Nevermind - just tried Xcode 7.3 Beta 4 and answered my own question. It still can't merge a branch into the trunk. Incredibly disappointing. It's a good thing that Xcode 6.4 still works on El Capitan, since that's the last known version of Xcode that can successfully merge a branch into the trunk. How this is still not fixed is truly beyond me.

I found the solution to my problem: My project paths had special characters (an è) and spaces in the directory names. This creates issues with git. I rebuild my project directory structure eliminating all spaces and special characters in the directory names, and now Xcode 7.2.1 displays file differences correctly. This also resolves issues where after committing a modified file, the file would then show up as being either deleted or added to the repository, necessitating an additional commit to get the status to be correct.


Bottom line: Don't use special characters or spaces in your git directory structure!

What is a git directory structure. Is same as prject folder structure in navigator?

I also meet this problem, the possible reason is the xcode be updated, then to open an exist project created by last version of xcode. the newly created project don't have this problem.
Xcode 7 The source control operation failed because the revision could not be found.
 
 
Q